使用Jasper格式化HTML代码无法生成PDF

时间:2019-03-29 16:46:12

标签: jasper-reports

我正在尝试从HTML代码生成报告,但是在生成PDF时遇到问题。在具有HTML的位置,生成的PDF格式不正确

    <!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0  -->
    <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="Generic builds html" pageWidth="595" pageHeight="842" whenNoDataType="BlankPage" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="10" bottomMargin="5" uuid="7485a8e1-c33a-4517-8d58-ed238a5e67ab">
      <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
      <property name="com.jaspersoft.studio.unit." value="pixel"/>
      <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
      <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
      <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
      <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
      <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
      <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
      <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
      <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
      <detail>
        <band height="810">
          <genericElement>
            <reportElement x="0" y="0" width="555" height="810" backcolor="#FFFFFF" uuid="8253f119-c8a5-44a9-a3fa-47e8297c32f0"/>
            <genericElementType namespace="http://jasperreports.sourceforge.net/jasperreports/html" name="htmlelement"/>
            <genericElementParameter name="htmlContent">
              <valueExpression><![CDATA["<p><img alt='' src='https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcShjeATe_p1qOlUPnTiMX2esyQr0DoNFO_1SBrZ2eTuGn8jh4Lq' style='float:right; height:123px; width:123px' /></p><p>&nbsp;</p><p>&nbsp;</p><p style='text-align:center'>&nbsp;</p><p style='text-align:center'><span style='font-size:14px'><strong>MEDSOM DIAG. M&Eacute;DICOS LTDA<br />Rua Dom Joaquim, 615<br />Florian&oacute;polis - SC CEP: 88015-310<br />Fone: 30282804 - 30282805<br />CNPJ: 792278720001/47</strong></span></p><p style='text-align:center'>&nbsp;</p><p style='text-align:center'>&nbsp;</p><h1 style='text-align:center'><span style='font-size:18px'><strong>DECLARA&Ccedil;&Atilde;O</strong></span></h1><p style='text-align:center'>&nbsp;</p><p style='text-align:center'><br /><span style='font-size:16px'>Declaramos para os devidos fins que o(a) Sr(a). Alisson da Silveira Mendes , compareceu a esta cl&iacute;nica no dia 06/03/19 , no hor&aacute;rio de 15:00 at&eacute; 15:30 para realiza&ccedil;&atilde;o de exames.&nbsp;</span><br /><br />&nbsp;</p><p style='text-align:center'>&nbsp;</p><p style='text-align:center'><span style='font-size:14px'>Florian&oacute;polis, <strong>06/03/19&nbsp;</strong></span></p><p style='text-align:center'>&nbsp;</p><p style='text-align:center'>&nbsp;</p><p style='text-align:center'>&nbsp;</p><p style='text-align:center'><span style='font-size:14px'><strong>Medsom Diagn&oacute;sticos M&eacute;dicos Ltda</strong></span></p><p style='text-align:center'>&nbsp;</p>"]]></valueExpression>
            </genericElementParameter>
            <genericElementParameter name="scaleType">
              <valueExpression><![CDATA["RealSize"]]></valueExpression>
            </genericElementParameter>
            <genericElementParameter name="horizontalAlign">
              <valueExpression><![CDATA["Right"]]></valueExpression>
            </genericElementParameter>
          </genericElement>
        </band>
      </detail>
    </jasperReport>

0 个答案:

没有答案