Images

The next component we will talk about is the Image component. The Image report item is a mechanism of putting graphics such as company logos into a report page. The BIRT Image component has a lot of capabilities that allow for static or dynamic image usage based on data, including image data in report designs for easier distribution of single reports and using image files from a resource location or library to allow for single images to be used across multiple reports. We can even use BLOB data stored in a database if the data is an imageWe will discuss a lot of these features later in the book. The icon for the image report item looks like the following:

Images

In the following exercise, we are going to insert a logo from the Eclipse home page at the top of the Hello World report.

  1. Open the HelloWorld.rptdesign file from the Classic_Cars_BIRT_Reports project.
  2. From the Palette, drag an Image object over to the Report Design pane, just above the Hello World label.
    Images
  3. The Edit Image Item dialog box pops up. In the Edit Image Item dialog, there are several options for putting images in reports. We can put in a URL for a remote image hosted on a web server. We can add an embedded image from our local file system that will get stored in the report itself as a base64 encoded image. If we have an image stored in your resources (more on that later), we can add it from there. We can also set a dynamic image based on script or data conditions. This is useful if we want to pass in a value for different companies and have different report headers to be displayed. For this exercise, keep the URI option checked for the Select Image from option and enter the following URL: http://www.eclipse.org/artwork/images/eclipse_bckgr_logo_fc_sm.jpg.
    Images
  4. Click OK. The report preview is illustrated as follows:
Images

The finished report shows the image, the Hello World label, and the report footer.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset