2015-12-29 45 views
1

我的報告只生成帶有圖片的pdf文件。 當圖像的大小爲800x1054;圖像非常適合(每頁1張圖像)。 但是,例如,如果圖像大小爲(667x1054),則圖像適合該頁面,並在667x1054圖像上方生成額外的空白頁面。爲什麼我的ireport中的圖像會生成額外的空白頁面?

這裏是我的iREPORT分享到人人代碼:

<?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> 
+0

問題仍然存在?,仍然有這個問題嗎? –

回答

1

如果你的格式寬x高(800,667是寬和1054是高度)

你的屬性scaleImage圖像:

RealHeight - 圖像可以垂直拉伸以匹配圖像高度的實際 ,同時保留聲明的寬度t他形象 元素。

,因爲它需要保持你的寬555px寬度爲667的圖像可以延伸其高度更然後用寬度800的圖像這將導致與寬度667的圖像將使用更多的高度,因此,您可能會看到溢出。

解決方案

  1. 降低您的reportElement的寬度(讓667x1054適合爲好)

  2. 設置你的reportElement的高度和寬度以填充頁面,並使用scaleImage="RetainShape"

相關問題