Jasper Report

Passing image stream to jasper report

3 steps to pass image stream to jasper report.

  1. Convert the image to stream and set it in parameter (“logo”)
  2. In jrxml file , create a parameter with parameter class as “java.io.InputStream”
  3. Place a image on the jrxml design, set “Image Expression” to $P{logo} and “Expression class” to java.lang.String

Single Textbox “Page {X} of {Y}” Page Counts

<variable name="CURRENT_PAGE_NUMBER" class="java.lang.Integer" resetType="Page">  
    <variableExpression><![CDATA[$V{PAGE_NUMBER}]]></variableExpression>  
</variable>
<textField evaluationTime="Auto">
    ...
    <textFieldExpression><![CDATA["Page "+ $V{CURRENT_PAGE_NUMBER} + " of " + $V{PAGE_NUMBER}]]></textFieldExpression>  
</textField>