>

보고서에서 다른 글꼴 크기를 사용하려고합니다. Jaspersoft Studio에는 올바른 글꼴 크기의 텍스트가 표시되지만 Java 소프트웨어를 사용하여 PDF로 내 보내면 전체 보고서에 대해 글꼴 크기 10이 표시됩니다.

다양한 글꼴을 시도했지만 같은 결과가 나옵니다. jasperreports-5.6.1을 사용하고 있습니다.

다음 병을 클래스 패스에 포함시켰다 :

  • jasperreports-5.6.1.jar
  • jasperreports-chart-theme-5.6.1.jar
  • jasperreports-fonts-5.6.1.jar
  • jasperreports-functions-5.6.1.jar

Java 프로그램을 사용하여 HTML로 내보내려고했지만 작동하지 않습니다. 내 보낸 형식에서 글꼴 크기 10을 가정합니다. 많은 글꼴 크기를 사용하려고했습니다.

이것은 나의 jrxml이다 :

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1  -->
<!-- 2015-09-29T14:58:11 -->
<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="fnc_venda_delivery_por_cliente_detalhado" pageWidth="595" pageHeight="842" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="1da45d48-333d-4496-ba82-e39cc4ea3ae7">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<parameter name="dataInicial" class="java.util.Date"/>
<parameter name="dataFinal" class="java.util.Date"/>
<parameter name="nomeSistema" class="java.lang.String"/>
<parameter name="nomeRelatorio" class="java.lang.String"/>
<parameter name="nomeEmpresa" class="java.lang.String"/>
<parameter name="nomeUsuario" class="java.lang.String"/>
<queryString>
    <![CDATA[]]>
</queryString>
<field name="vendaData" class="java.util.Date"/>
<field name="numeroDocumentoVenda" class="java.lang.String"/>
<field name="numeroSerieSat" class="java.lang.String"/>
<field name="empresaDescricao" class="java.lang.String"/>
<field name="terminalPdv.descricao" class="java.lang.String"/>
<field name="parcelaNumero" class="java.lang.Integer"/>
<field name="parcelaValor" class="java.math.BigDecimal"/>
<field name="pagamentoData" class="java.util.Date"/>
<field name="pagamentoValor" class="java.math.BigDecimal"/>
<field name="pagamentoJuros" class="java.math.BigDecimal"/>
<field name="pagamentoDesconto" class="java.math.BigDecimal"/>
<background>
    <band splitType="Stretch"/>
</background>
<title>
    <band splitType="Stretch">
        <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
    </band>
</title>
<pageHeader>
    <band splitType="Stretch">
        <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
    </band>
</pageHeader>
<columnHeader>
    <band height="15" splitType="Stretch">
        <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
        <staticText>
            <reportElement x="1" y="0" width="54" height="15" uuid="fd3d2c8d-07ef-4cfd-a62d-7b2fbe9f4dca">
                <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
            </reportElement>
            <textElement>
                <font fontName="UbuntuMonoFont" size="7" isBold="true"/>
            </textElement>
            <text><![CDATA[Data Venda]]></text>
        </staticText>
        <staticText>
            <reportElement x="58" y="0" width="30" height="15" uuid="1a2e14de-be90-4a0c-8b44-dff30061a059"/>
            <textElement>
                <font fontName="UbuntuMonoFont" size="7" isBold="true"/>
            </textElement>
            <text><![CDATA[Cupom]]></text>
        </staticText>
        <staticText>
            <reportElement x="110" y="0" width="44" height="15" uuid="f6f31d52-0b69-47f2-8eeb-d7585d45d514"/>
            <textElement>
                <font fontName="UbuntuMonoFont" size="7" isBold="true"/>
            </textElement>
            <text><![CDATA[SAT]]></text>
        </staticText>
        <staticText>
            <reportElement x="263" y="0" width="58" height="15" uuid="126d1c6d-ae28-4538-9fb2-5b65c45bcf5c"/>
            <textElement>
                <font fontName="UbuntuMonoFont" size="7" isBold="true"/>
            </textElement>
            <text><![CDATA[Terminal]]></text>
        </staticText>
        <staticText>
            <reportElement x="370" y="0" width="40" height="15" uuid="cf4976c9-a1b8-4b7b-9369-6996da1b990b"/>
            <textElement>
                <font fontName="UbuntuMonoFont" size="7" isBold="true"/>
            </textElement>
            <text><![CDATA[Data Pgto]]></text>
        </staticText>
        <staticText>
            <reportElement x="325" y="0" width="42" height="15" uuid="30add7e7-08ea-45f0-8c28-a19cc225df1f"/>
            <textElement textAlignment="Right">
                <font fontName="UbuntuMonoFont" size="7" isBold="true"/>
            </textElement>
            <text><![CDATA[Valor]]></text>
        </staticText>
        <staticText>
            <reportElement x="90" y="0" width="15" height="15" uuid="c0c6fbdf-f881-4c6d-936b-e40929549143">
                <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
            </reportElement>
            <textElement textAlignment="Left">
                <font fontName="UbuntuMonoFont" size="7" isBold="true"/>
            </textElement>
            <text><![CDATA[P]]></text>
        </staticText>
        <staticText>
            <reportElement x="155" y="0" width="70" height="15" uuid="526bf8cc-9aea-4cb4-b719-4c12c764c87e"/>
            <textElement>
                <font fontName="UbuntuMonoFont" size="7" isBold="true"/>
            </textElement>
            <text><![CDATA[Empresa]]></text>
        </staticText>
        <staticText>
            <reportElement x="410" y="0" width="59" height="15" uuid="e2b262ed-bb0a-454a-b601-76e796b2601e"/>
            <textElement textAlignment="Right">
                <font fontName="UbuntuMonoFont" size="7" isBold="true"/>
            </textElement>
            <text><![CDATA[Valor Pgto]]></text>
        </staticText>
        <staticText>
            <reportElement x="472" y="0" width="40" height="15" uuid="e1ab4731-fcb3-4b0c-858e-6e536125bdda"/>
            <textElement textAlignment="Right">
                <font fontName="UbuntuMonoFont" size="7" isBold="true"/>
            </textElement>
            <text><![CDATA[Juros]]></text>
        </staticText>
        <staticText>
            <reportElement x="515" y="0" width="40" height="15" uuid="a14801b3-e7c7-4e87-a700-d1d877ffef55"/>
            <textElement textAlignment="Right">
                <font fontName="UbuntuMonoFont" size="7" isBold="true"/>
            </textElement>
            <text><![CDATA[Desconto]]></text>
        </staticText>
    </band>
</columnHeader>
<detail>
    <band height="31" splitType="Stretch">
        <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
        <textField pattern="dd/MM/yy HH:mm" isBlankWhenNull="true">
            <reportElement style="TesteFont6" x="1" y="1" width="55" height="30" uuid="fe73298a-11e2-458b-ba1f-a50d3cbc2dc8">
                <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
            </reportElement>
            <textElement>
                <font fontName="Times New Roman" size="6"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{vendaData}]]></textFieldExpression>
        </textField>
        <textField isBlankWhenNull="true">
            <reportElement style="TesteFont6" x="58" y="1" width="30" height="30" uuid="b94362ef-8ab9-4147-8c70-1dc340afcebc">
                <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
            </reportElement>
            <textElement>
                <font fontName="Times New Roman" size="6"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{numeroDocumentoVenda}]]></textFieldExpression>
        </textField>
        <textField isBlankWhenNull="true">
            <reportElement style="TesteFont6" x="110" y="1" width="43" height="30" uuid="22009fa5-77a0-4d3c-a14b-c8bdc0762eee">
                <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
            </reportElement>
            <textElement>
                <font fontName="Times New Roman" size="6"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{numeroSerieSat}]]></textFieldExpression>
        </textField>
        <textField isBlankWhenNull="true">
            <reportElement x="263" y="1" width="59" height="30" uuid="954772cb-f737-49e0-a70c-7aa8e60337f5">
                <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
            </reportElement>
            <textElement>
                <font fontName="Times New Roman" size="6"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{terminalPdv.descricao}]]></textFieldExpression>
        </textField>
        <textField isBlankWhenNull="true">
            <reportElement x="155" y="1" width="105" height="30" uuid="302c9609-68db-47c7-bc4d-456aa1c6da8b">
                <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
            </reportElement>
            <textElement>
                <font fontName="Times New Roman" size="6"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{empresaDescricao}]]></textFieldExpression>
        </textField>
        <textField isBlankWhenNull="true">
            <reportElement style="TesteFont6" x="90" y="1" width="15" height="30" uuid="ed5d0d92-214b-4955-9198-0f2a4a49a062">
                <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
            </reportElement>
            <textElement textAlignment="Left">
                <font fontName="Times New Roman" size="6"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{parcelaNumero}]]></textFieldExpression>
        </textField>
        <textField pattern="dd/MM/yy HH:mm" isBlankWhenNull="true">
            <reportElement x="370" y="1" width="55" height="30" uuid="4b4b93d9-1b83-4f04-8d07-10ddcd10e394">
                <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
            </reportElement>
            <textElement>
                <font fontName="Times New Roman" size="6"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{pagamentoData}]]></textFieldExpression>
        </textField>
        <textField pattern="#,##0.00" isBlankWhenNull="true">
            <reportElement x="325" y="1" width="42" height="30" uuid="8345515e-e50d-4820-aa56-fdfa0a789be7">
                <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
            </reportElement>
            <textElement textAlignment="Right">
                <font fontName="Times New Roman" size="6"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{parcelaValor}]]></textFieldExpression>
        </textField>
        <textField pattern="#,##0.00" isBlankWhenNull="true">
            <reportElement x="429" y="1" width="40" height="30" uuid="b07508eb-be76-44ec-b14a-5cc93d09358f">
                <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
            </reportElement>
            <textElement textAlignment="Right">
                <font fontName="Times New Roman" size="6"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{pagamentoValor}]]></textFieldExpression>
        </textField>
        <textField pattern="#,##0.00" isBlankWhenNull="true">
            <reportElement x="472" y="1" width="40" height="30" uuid="eb747941-b01d-4c15-8ab8-61765c15cd37">
                <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
            </reportElement>
            <textElement textAlignment="Right">
                <font fontName="Times New Roman" size="6"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{pagamentoJuros}]]></textFieldExpression>
        </textField>
        <textField pattern="#,##0.00" isBlankWhenNull="true">
            <reportElement x="515" y="1" width="40" height="30" uuid="5c195c3d-8bbe-4f96-8a6c-7f891339a508">
                <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
            </reportElement>
            <textElement textAlignment="Right">
                <font fontName="Times New Roman" size="6"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{pagamentoDesconto}]]></textFieldExpression>
        </textField>
    </band>
</detail>
<columnFooter>
    <band splitType="Stretch">
        <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
    </band>
</columnFooter>
<pageFooter>
    <band splitType="Stretch">
        <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
    </band>
</pageFooter>
<summary>
    <band splitType="Stretch">
        <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
    </band>
</summary>


  • 답변 # 1

    Google에서이 게시물을 찾았습니다 : http://community.jaspersoft.com/questions/826303/font-size-tomcat-pdf-generation

    내 문제를 해결했지만 응용 프로그램 내에서 보고서를 컴파일하는 아이디어가 마음에 들지 않습니다. Jaspersoft Studio는 올바른 방법으로 컴파일해야합니다.

    보고서를 작성하기 전에 자바 프로그램 내에서 jxml 파일을 컴파일하여 .jasper 파일을 생성해야합니다.

    String jrxmlFile = "\path\to\file\report.jrxml";
    String jasperDestination = "\path\to\file\report.jasper";
    JasperCompileManager.compileReportToFile(jrxmlFile, jasperDestination);
    
    

    누군가 자바 코드 내에서 jrxml을 컴파일하지 않고이 문제를 해결했다면 알려주세요. 그러면 정답으로 표시하겠습니다.

  • 답변 # 2

    잘 나왔지만 그냥 컴파일했습니다. 동일한 원본 버전의 jrxml 파일로 작동했습니다 ...

    내 프로그램 jasperreport 5.1을 사용하기 전에 5.6 버전의 ireport로 컴파일하기 시작했습니다 .. 그리고 이것은 작동하지 않습니다 ...

    그래서 마침내 5.1 버전을 사용하고 컴파일하고 잘 작동했습니다

  • 이전 sql server - SQL 쿼리에서 저장 프로 시저를 실행할 수 없음
  • 다음 javascript - 웹팩 4 모듈을 찾을 수 없음