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 ...

Get JasperReports 3.5 for Java Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.