Including Images

BI Publisher supports a number of methods for including images in your reports:

  • Inserting images.

  • Importing images.

  • Rendering image field data (BLOB).

Inserting Images

To directly insert a .jpg, .gif, or .png image file into a template:

  1. Select Insert, and then Picture, and then From File while the template is open in Microsoft Word.

  2. Select the desired .jpg, .gif, or .png file to insert into the template.

  3. Save the template.

Note:

Oracle recommends that you use the Microsoft Word Insert menu option to insert the image, because the additional properties that you need to set for the RTF template to correctly generate reports with those images are automatically set by means of this method. Additionally, dragging and dropping an image onto a template creates a link to the local machine being used and may cause problems when the report is generated.

Importing Images

To import an image from a sub-template file:

  1. Embed the .jpg, .gif, or .png into the sub-template file.

    For example,

    <?template:logo2x.5?>
     Oracle_Logo
    <?end template?>
    

    where Oracle_Logo is the actual .jpg, .gif, or .png.

  2. Import the sub-template file that includes the image by including the following syntax at the top of the primary template file:

    <?import:psxmlp://sub-template_NAME?>

    In this code sample, sub-template_NAME is the registered sub-template ID in the Content Library.

  3. Add the calling details in the primary template at the appropriate location using the following syntax:

    <?call-template:logo2x.5?>

    In this code sample, logo2x.5 is the name of the component that contains the image in the sub-template file.

See Incorporating Sub-Templates.

Rendering Image Field Data (BLOB)

BI Publisher supports the rendering of BLOB (Base64 encoded) data fields in an XML file.

To render an image at runtime, add the following syntax in a Form Field Help Text box :

<fo:instream-foreign-object content-type="image/jpg">
<xsl:value-of select="IMAGE_ELEMENT"/>
</fo:instream-foreign-object>

where image/jpg is the MIME type of the image (other MIME types are image/gif and image/png) and IMAGE_ELEMENT is the element containing BLOB (Base64 encoded) data in the XML file.

Also, you can specify height and width attributes for the image to set its size in the published report. You can specify height and width attributes in inches, pixels, centimeters, or by percentage. BI Publisher scales the image to fit the size that you define. The following examples illustrate the attributes for height and width of an image:

Image size attributes in inches:

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

Image size attributes in pixels:

<fo:instream-foreign-object content-type="image/jpg" 
height="300 px" width="400 px">

Image size attributes in centimeters:

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

Image size attributes as a percentage of the original dimensions:

<fo:instream-foreign-object content-type="image/jpg" 
height="300%" width="300%">

Note:

BI Publisher supports rendering of images in all output formats—PDF, HTML, RTF, and XLS.

Query and Connected Query data sources containing image fields generate the binary base64 encoded data string for these image fields in the generated XML file provided the query’s Image Fields property is set correctly.

If you are using a Query or Connected Query data source, follow these steps for the underlying query containing the image field:

  1. Open a query definition (Reporting Tools, Query, Query Manager).

  2. Click the Properties link.

  3. In the Image Fields group box, select Image Data.

  4. Click OK, and save the query.

See Query: Viewing and Editing Query Properties, Setting Image Fields.