title: JasperReport image dynamic vertical stretching depending on page size - can it be done?
body: <p>I have a jasper report that looks like a certificate.</p>
  
  <p>I have a background image that serves as the attractive bordering or frame of the whole page.</p>
  
  <p>The problem is, if for example, the name in text field is much bigger than the element container, it creates extra white space in the bottom.</p>
  
  <p>The background image / frame is not stretching to stretch the the whole edges of the page.</p>
  
  <p>The same is true when the text fields are shorter. But in this case, the page is shortened to the point that you almost cannot see the bottom portion of the frame.</p>
  
  <p>I want the image to dynamically stretch depending on the final size of the page at runtime.</p>
  
  <p>Here is the look of my design:
  <a href="https://i.stack.imgur.com/px7Tj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/px7Tj.png" alt="enter image description here"></a></p>
  
  <p>This is what happens when it is compiled, as you can see there are extra white spaces at the bottom:
  <a href="https://i.stack.imgur.com/BziM2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BziM2.png" alt="enter image description here"></a> </p>
  
  <p>This is the current setting of my image.. </p>
  
  <p><a href="https://i.stack.imgur.com/zz5sk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zz5sk.png" alt="enter image description here"></a></p>
  
  <p>Position Type: Float</p>
  
  <p>Stretch Type: ContainerBottom</p>
  
  <p><strong>The jrxml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!-- Created with Jaspersoft Studio version 6.8.0.final using JasperReports Library version 6.8.0-2ed8dfabb690ff337a5797129f2cd92902b0c87b  --&gt;
  &lt;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="paiwi-certificate-pdf" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="792" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isIgnorePagination="true" uuid="28bcb6f8-04d6-48df-ab31-e1bedc2f2434"&gt;
      &lt;property name="net.sf.jasperreports.print.create.bookmarks" value="false"/&gt;
      &lt;property name="com.jaspersoft.studio.unit." value="pixel"/&gt;
      &lt;parameter name="SUBREPORT_DIR" class="java.lang.String"/&gt;
      &lt;parameter name="farmContactListSubreportDataSource" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/&gt;
      &lt;parameter name="farmName" class="java.lang.String"/&gt;
      &lt;parameter name="farmLogo" class="java.lang.String"/&gt;
      &lt;parameter name="farmAddress" class="java.lang.String"/&gt;
      &lt;parameter name="farmBusinessAddress" class="java.lang.String"/&gt;
      &lt;parameter name="temporaryPartnersName" class="java.lang.String"/&gt;
      &lt;parameter name="partnerName" class="java.lang.String"/&gt;
      &lt;parameter name="partnerContactNumber" class="java.lang.String"/&gt;
      &lt;parameter name="partnerEmail" class="java.lang.String"/&gt;
      &lt;parameter name="packageName" class="java.lang.String"/&gt;
      &lt;parameter name="batchName" class="java.lang.String"/&gt;
      &lt;queryString&gt;
          &lt;![CDATA[]]&gt;
      &lt;/queryString&gt;
      &lt;detail&gt;
          &lt;band height="612" splitType="Stretch"&gt;
              &lt;property name="com.jaspersoft.studio.unit.height" value="px"/&gt;
              &lt;staticText&gt;
                  &lt;reportElement positionType="Float" x="146" y="80" width="224" height="40" forecolor="#332411" uuid="cb95bd0b-631e-4363-80f5-22d0b0e481fe"&gt;
                      &lt;property name="com.jaspersoft.studio.unit.width" value="px"/&gt;
                  &lt;/reportElement&gt;
                  &lt;textElement markup="none"&gt;
                      &lt;font fontName="Georgia" size="34" isBold="false"/&gt;
                  &lt;/textElement&gt;
                  &lt;text&gt;&lt;![CDATA[CERTIFICATE]]&gt;&lt;/text&gt;
              &lt;/staticText&gt;
              &lt;textField isStretchWithOverflow="true" isBlankWhenNull="true"&gt;
                  &lt;reportElement positionType="Float" x="50" y="372" width="446" height="28" uuid="6281f2a7-4eca-4319-b298-22184617a6d3"&gt;
                      &lt;property name="com.jaspersoft.studio.unit.width" value="px"/&gt;
                      &lt;property name="com.jaspersoft.studio.unit.x" value="px"/&gt;
                      &lt;property name="com.jaspersoft.studio.unit.height" value="px"/&gt;
                  &lt;/reportElement&gt;
                  &lt;textElement&gt;
                      &lt;font fontName="Georgia" size="24" isBold="false" isUnderline="false"/&gt;
                  &lt;/textElement&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$P{farmName}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField isStretchWithOverflow="true" isBlankWhenNull="true"&gt;
                  &lt;reportElement positionType="Float" x="50" y="400" width="446" height="17" uuid="f19dc14b-3ada-460b-8633-85fd5a896d45"&gt;
                      &lt;property name="com.jaspersoft.studio.unit.width" value="px"/&gt;
                      &lt;property name="com.jaspersoft.studio.unit.x" value="px"/&gt;
                      &lt;property name="com.jaspersoft.studio.unit.height" value="px"/&gt;
                  &lt;/reportElement&gt;
                  &lt;textElement&gt;
                      &lt;font fontName="Georgia" size="14" isBold="false" isUnderline="false"/&gt;
                  &lt;/textElement&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$P{farmAddress}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField isStretchWithOverflow="true" isBlankWhenNull="true"&gt;
                  &lt;reportElement positionType="Float" x="50" y="417" width="446" height="17" uuid="dec9944a-2758-4202-acfe-6f97df346b8f"&gt;
                      &lt;property name="com.jaspersoft.studio.unit.width" value="px"/&gt;
                      &lt;property name="com.jaspersoft.studio.unit.x" value="px"/&gt;
                      &lt;property name="com.jaspersoft.studio.unit.height" value="px"/&gt;
                  &lt;/reportElement&gt;
                  &lt;textElement&gt;
                      &lt;font fontName="Georgia" size="14" isBold="false" isUnderline="false"/&gt;
                  &lt;/textElement&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$P{farmBusinessAddress}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField isStretchWithOverflow="true" isBlankWhenNull="true"&gt;
                  &lt;reportElement positionType="Float" x="164" y="180" width="473" height="40" forecolor="#332411" uuid="b2a59bb8-1557-498f-b17a-3f0e561bb11b"&gt;
                      &lt;property name="com.jaspersoft.studio.unit.width" value="px"/&gt;
                      &lt;property name="com.jaspersoft.studio.unit.x" value="px"/&gt;
                  &lt;/reportElement&gt;
                  &lt;textElement textAlignment="Center"&gt;
                      &lt;font fontName="Georgia" size="37" isBold="false" isUnderline="false"/&gt;
                  &lt;/textElement&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$P{partnerName} != null &amp;&amp; !$P{partnerName}.equalsIgnoreCase("") ? $P{partnerName} : $P{temporaryPartnersName}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;image onErrorType="Blank"&gt;
                  &lt;reportElement positionType="Float" x="569" y="338" width="164" height="160" uuid="717d6475-3d42-4e54-a69a-7271bc862e33"/&gt;
                  &lt;imageExpression&gt;&lt;![CDATA[$P{farmLogo}]]&gt;&lt;/imageExpression&gt;
              &lt;/image&gt;
              &lt;staticText&gt;
                  &lt;reportElement positionType="Float" x="416" y="81" width="228" height="40" forecolor="#332411" uuid="f2a78f2d-ed74-45b9-89e8-3365c4afe801"&gt;
                      &lt;property name="com.jaspersoft.studio.unit.width" value="px"/&gt;
                  &lt;/reportElement&gt;
                  &lt;textElement markup="none"&gt;
                      &lt;font fontName="Georgia" size="34" isBold="false"/&gt;
                  &lt;/textElement&gt;
                  &lt;text&gt;&lt;![CDATA[COMPLETION]]&gt;&lt;/text&gt;
              &lt;/staticText&gt;
              &lt;staticText&gt;
                  &lt;reportElement positionType="Float" x="378" y="80" width="33" height="40" forecolor="#332411" uuid="e1c7ac87-81ce-4e8d-b718-2aee4f139003"/&gt;
                  &lt;textElement markup="none"&gt;
                      &lt;font fontName="Georgia" size="34" isBold="false" isItalic="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;text&gt;&lt;![CDATA[of]]&gt;&lt;/text&gt;
              &lt;/staticText&gt;
              &lt;staticText&gt;
                  &lt;reportElement positionType="Float" x="311" y="148" width="179" height="15" forecolor="#6E6E6E" uuid="3d5afae8-14e2-4a3b-8471-db8388e2309f"&gt;
                      &lt;property name="com.jaspersoft.studio.unit.height" value="px"/&gt;
                  &lt;/reportElement&gt;
                  &lt;textElement markup="none"&gt;
                      &lt;font fontName="Verdana" size="12" isBold="false"/&gt;
                      &lt;paragraph lineSpacingSize="1.0"/&gt;
                  &lt;/textElement&gt;
                  &lt;text&gt;&lt;![CDATA[THIS ACKNOWLEDGES THAT]]&gt;&lt;/text&gt;
              &lt;/staticText&gt;
              &lt;staticText&gt;
                  &lt;reportElement positionType="Float" x="290" y="249" width="232" height="15" forecolor="#6E6E6E" uuid="4c301efe-c460-478e-873a-d16430000b18"&gt;
                      &lt;property name="com.jaspersoft.studio.unit.height" value="px"/&gt;
                  &lt;/reportElement&gt;
                  &lt;textElement markup="none"&gt;
                      &lt;font fontName="Verdana" size="12" isBold="false"/&gt;
                      &lt;paragraph lineSpacingSize="1.0"/&gt;
                  &lt;/textElement&gt;
                  &lt;text&gt;&lt;![CDATA[HAS SUCCESSFULLY COMPLETED THE]]&gt;&lt;/text&gt;
              &lt;/staticText&gt;
              &lt;staticText&gt;
                  &lt;reportElement positionType="Float" x="50" y="357" width="232" height="15" forecolor="#6E6E6E" uuid="1060f753-1051-4925-9efe-c2ee62146b25"&gt;
                      &lt;property name="com.jaspersoft.studio.unit.height" value="px"/&gt;
                  &lt;/reportElement&gt;
                  &lt;textElement markup="none"&gt;
                      &lt;font fontName="Verdana" size="12" isBold="false"/&gt;
                      &lt;paragraph lineSpacingSize="1.0"/&gt;
                  &lt;/textElement&gt;
                  &lt;text&gt;&lt;![CDATA[ACKNOWLEDGED BY:]]&gt;&lt;/text&gt;
              &lt;/staticText&gt;
              &lt;textField isStretchWithOverflow="true" isBlankWhenNull="true"&gt;
                  &lt;reportElement positionType="Float" x="275" y="279" width="263" height="17" uuid="3ab3ec94-b64f-42df-b475-7996bcac1abb"&gt;
                      &lt;property name="com.jaspersoft.studio.unit.width" value="px"/&gt;
                      &lt;property name="com.jaspersoft.studio.unit.x" value="px"/&gt;
                      &lt;property name="com.jaspersoft.studio.unit.height" value="px"/&gt;
                  &lt;/reportElement&gt;
                  &lt;textElement textAlignment="Center"&gt;
                      &lt;font fontName="Georgia" size="14" isBold="false" isUnderline="false"/&gt;
                  &lt;/textElement&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$P{packageName}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;staticText&gt;
                  &lt;reportElement positionType="Float" x="359" y="296" width="43" height="16" forecolor="#000000" uuid="c6e10785-2750-4247-af0c-6cbafa3aa294"/&gt;
                  &lt;textElement markup="none"&gt;
                      &lt;font fontName="Georgia" size="14" isBold="false"/&gt;
                      &lt;paragraph lineSpacingSize="1.0"/&gt;
                  &lt;/textElement&gt;
                  &lt;text&gt;&lt;![CDATA[Batch:]]&gt;&lt;/text&gt;
              &lt;/staticText&gt;
              &lt;textField isStretchWithOverflow="true" isBlankWhenNull="true"&gt;
                  &lt;reportElement positionType="Float" x="402" y="296" width="48" height="16" forecolor="#000000" uuid="dff76163-3fd3-4bf6-94fd-de4612485e29"&gt;
                      &lt;property name="com.jaspersoft.studio.unit.x" value="px"/&gt;
                  &lt;/reportElement&gt;
                  &lt;textElement textAlignment="Center"&gt;
                      &lt;font fontName="Georgia" size="14" isBold="false" isUnderline="false"/&gt;
                  &lt;/textElement&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$P{batchName}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;image onErrorType="Blank"&gt;
                  &lt;reportElement positionType="Float" x="140" y="279" width="126" height="30" uuid="b0c2acd4-1a0c-4fe6-9a94-be43fe67d704"/&gt;
                  &lt;imageExpression&gt;&lt;![CDATA["https://i.imgur.com/Ug4T4oX.png"]]&gt;&lt;/imageExpression&gt;
              &lt;/image&gt;
              &lt;image onErrorType="Blank"&gt;
                  &lt;reportElement positionType="Float" x="550" y="279" width="126" height="30" uuid="9d2cddda-e519-42e2-b74b-554f4c102ef2"/&gt;
                  &lt;imageExpression&gt;&lt;![CDATA["https://i.imgur.com/paQHNxJ.png"]]&gt;&lt;/imageExpression&gt;
              &lt;/image&gt;
              &lt;image scaleImage="RetainShape" vAlign="Bottom" onErrorType="Blank" evaluationTime="Page"&gt;
                  &lt;reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="0" width="782" height="612" isPrintInFirstWholeBand="true" uuid="2dadd1da-0694-4e21-86de-fae790844411"&gt;
                      &lt;property name="com.jaspersoft.studio.unit.height" value="px"/&gt;
                  &lt;/reportElement&gt;
                  &lt;imageExpression&gt;&lt;![CDATA["https://i.imgur.com/y8uffu8.png"]]&gt;&lt;/imageExpression&gt;
              &lt;/image&gt;
          &lt;/band&gt;
      &lt;/detail&gt;
  &lt;/jasperReport&gt;
  </code></pre>