我已经使用 iReport 5.6.0 来构建报告。我在静态字段中使用了 SolaimanLipi 字体。 iReport内部视图没有问题,但保存为pdf(在pdf阅读器或任何浏览器中打开)bangla字体无法正确显示。
jrxml代码:
<?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="challanReport" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="770" leftMargin="54" rightMargin="18" topMargin="20" bottomMargin="20" uuid="9126e000-dc70-4a76-9013-4a4fa290f0df">
<pageHeader>
<band height="273" splitType="Stretch">
<staticText>
<reportElement x="13" y="10" width="403" height="20" uuid="1d2c7070-63f4-4a43-b3a2-63dc4c27c6f2"/>
<textElement>
<font fontName="SolaimanLipi" pdfEncoding="Identity-H"/>
</textElement>
<text><![CDATA[বাংলাদেশ ব্যাংক/সোনালী ব্যাংকের ....ঢাকা....জেলার....মহাখালী....শাখায় টাকা জমা দেওয়ার চালান ।]]></text>
</staticText>
<staticText>
<reportElement x="429" y="10" width="69" height="20" uuid="21401d70-386e-4f01-bf34-586d58991b62"/>
<box>
<topPen lineWidth="0.25"/>
<leftPen lineWidth="0.25"/>
<bottomPen lineWidth="0.25"/>
<rightPen lineWidth="0.25"/>
</box>
<textElement textAlignment="Center">
<font fontName="SolaimanLipi" pdfFontName="Helvetica" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[১ম(মূল)কপি]]></text>
</staticText>
<staticText>
<reportElement x="13" y="50" width="512" height="60" uuid="ee6769a0-b25e-4f60-b783-58b535f955d7"/>
<box leftPadding="4">
<topPen lineWidth="0.25"/>
<leftPen lineWidth="0.25"/>
<bottomPen lineWidth="0.25"/>
<rightPen lineWidth="0.25"/>
</box>
<textElement>
<font fontName="SolaimanLipi" pdfEncoding="Identity-H"/>
</textElement>
<text><![CDATA[বিভাগের নাম এবং চালানের পৃষ্ঠাংকনকারী কর্মকর্তার নাম, পদবী ও দপ্তর l *]]></text>
</staticText>
<staticText>
<reportElement x="13" y="30" width="512" height="20" uuid="1e86fa4b-88a3-4e05-b37a-3a4dbd0b2963"/>
<box>
<topPen lineWidth="0.25"/>
<leftPen lineWidth="0.25"/>
<bottomPen lineWidth="0.25"/>
<rightPen lineWidth="0.25"/>
</box>
<textElement textAlignment="Center">
<font fontName="SolaimanLipi" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[জমা প্রদানকারী কর্তৃক পূরণ করিতে হইবে |]]></text>
</staticText>
</band>
</pageHeader>
答案 0 :(得分:0)
第1步
在jasper studio font Installation instruction
现在在报告中使用此自定义字体
第2步
如果您在项目构建路径中手动添加字体,则忽略字体安装过程。
字体安装命令
mvn install:install-file -Dfile=/your-jar-file-directory/fontName.jar -DgroupId=bangla -DartifactId=bangla -Dversion=1.0 -Dpackaging=jar
安装字体jar之后,您需要在pom文件中添加依赖项
样本依赖示例
<dependency>
<groupId>bangla</groupId>
<artifactId>bangla</artifactId>
<version>1.0</version>
</dependency>