Adding images to a report
Images can be added to a report by using the JRXML element <image>
. The report images can be loaded from memory, disk, or a URL. Where to obtain the image is determined by the <imageExpression>
subelement of the <image>
element.
The following example illustrates how to add an image to a report:
<?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ImageDemoReport"> <background> <band height="391"> <image> <reportElement x="65" y="0" width="391" height="391"/> <imageExpression class="java.lang.String"> <![CDATA["reports/company_logo.gif"]]> </imageExpression> </image>...