pdf中的孟加拉字体在iReport中无法正确显示

问题描述 投票:2回答:1

我已经使用iReport 5.6.0来生成报告。我在静态字段中使用了[[SolaimanLipi字体。 iReport内部视图没问题,但是另存为pdf(在pdf阅读器或任何浏览器中打开)后,孟加拉字体无法正确显示。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>

iReport内部视图:enter image description here

iReport外部视图:enter image description here如何解决呢?

jasper-reports export-to-pdf
1个回答
0
投票
使用jasper报告以pdf格式正确显示pdf格式的任何一种Unicode字体

Step-1

    下载您想要的Unicode字体xxx.ttf扩展名
  • 在jasper studio font Installation instruction中安装此字体
  • 现在在报告中使用此自定义字体

Step-2

    从Jaspersoft-studio导出自定义字体罐
  • 在Java构建路径中添加此字体jar或在Maven存储库中安装此字体
  • 如果您在项目构建路径中手动添加字体,则忽略字体安装过程。

    字体安装命令

  • mvn install:install-file -Dfile=/your-jar-file-directory/fontName.jar -DgroupId=bangla -DartifactId=bangla -Dversion=1.0 -Dpackaging=jar
    安装字体罐后,您需要在pom文件中添加依赖项

    样本依赖示例

    <dependency> <groupId>bangla</groupId> <artifactId>bangla</artifactId> <version>1.0</version> </dependency>
    © www.soinside.com 2019 - 2024. All rights reserved.