I´ve a report that generates a pdf files with images only. When the image has the size 800x1054; the image fits perfectly (1 image per page). But for example if the image size is (667x1054) the image fits the page and it generates an extra blank page above the 667x1054 image.
Here is my ireport code:
<?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="ReporteExpediente" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d978dab3-2ee3-486f-b62c-7e6817ee39da">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="imagen" class="java.io.InputStream">
<fieldDescription><![CDATA[imagen]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="166" splitType="Stretch">
<image scaleImage="RealHeight">
<reportElement x="0" y="0" width="555" height="166" uuid="9b2798da-ca28-4aeb-a8de-8299718c3e40"/>
<imageExpression><![CDATA[$F{imagen}]]></imageExpression>
</image>
</band>
</detail>
</jasperReport>
If your format is width x height (800,667 is width and 1054 is height)
Your attribute scaleImage
on image:
RealHeight - the image can be stretched vertically to match the actual image height, while preserving the declared width of the image element.
since it needs to preserve your width 555px an image with width 667 can stretch its height more then an image with width 800. This will result in that an image with width 667 will use more height and therefore you may see the overflow.
Solutions
Decrease the width of your reportElement (so that 667x1054 fits as well)
Set the height and width of your reportElement to fill the page and use scaleImage="RetainShape"