Tuesday, March 29, 2016

How To Insert Images and Logo in the XML Publisher Reports and Documents

XML/BI Publisher supports several methods for including images in published documents.
Please perform any of the following methods: 

1) URL Reference
* Insert a dummy image in the template.
* In the Format Picture dialog box select the Web tab.
* Enter the following syntax in the Alternative text region to reference the image URL:
* url:{'http://image location'}
e.g.: url:{'http://www.oracle.com/images/ora_log.gif'}

2) OA Media Directory Reference
* Insert a dummy image in the template.
* In the Format Picture dialog box select the Web tab.
* Enter the following syntax in the Alternative text region to reference the OA_MEDIA directory:
url:{'{OA_MEDIA}/IMAGE_FILE'}
e.g: url:{{OA_MEDIA}/ORACLE_LOGO.gif'}

3) Element Reference from XML File
* Insert a dummy image in the template.
* In the Format Picture dialog box select the Web tab.
* Enter the following syntax in the Alternative text region to reference the image URL:
url:{IMAGE_LOCATION}
where IMAGE_LOCATION is an element from the XML file that holds the full URL to the image.
* Another option is to build a URL based on multiple elements at runtime. Just use the concat function to build the URL string.
e.g.: Syntax: url:{concat('$[OA_MEDIA]/',.//IMAGE_FILE)}
* This method can also be used with the OA_MEDIA reference as follows:
url:{concat('$[OA_MEDIA]/',.//IMAGE_FILE)}

4) Rendering an Image Retrieved from BLOB Data
If the data source is an XML/BI Publisher Data Template and the resulting XML contains image data that had been stored as a BLOB in the database, use the following
syntax in a form field inserted in your template where you want the image to render at runtime:
<fo:instream-foreign-object content type="image/jpg">
<xsl:value-of select="IMAGE_ELEMENT"/>
</fo:instram-foreign-object>

where
           image/jpg
is the MIME type of the image (other options might be: image/gif and image/png)
and

          IMAGE_ELEMENT
is the element name of the BLOB in your XML data.

Note:  Height and width attributes can be specified for the image to set its size in the published report. XML/BI Publisher will scale the image to fit the box size defined.
For Example:  To set the size of the example above to three inches by four inches, enter the following:
 <fo:instream-foreign-object content type="image/jpg" height="3 in" width="4 in">
<xsl:value-of select="IMAGE_ELEMENT"/>
</fo:instram-foreign-object>
Specify in pixels as follows:
<fo:instream-foreign-object content type="image/jpg" height="300 px" width="4 px">

or in centimeters:
<fo:instream-foreign-object content type="image/jpg" height="3 cm " width="4 cm">

or as a percentage of the original dimensions:
<fo:instream-foreign-object content type="image/jpg" height="300%" width="300%">


No comments:

Post a Comment

Best Blogger TipsGet Flower Effect