I have this file .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="multi1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c8a053f6-858e-427b-aec1-89231aadddd6">
<title>
<band height="79" splitType="Stretch">
<staticText>
<reportElement x="104" y="0" width="313" height="25" uuid="fa5e3e6e-26f7-4973-a2d5-3c3b7a5e8227"/>
<textElement textAlignment="Center">
<font size="16" fontName="Lohit Devanagari" isPdfEmbedded="true" pdfEncoding="Identity-H" />
</textElement>
<text><![CDATA[अतिदेय राशि के पुनर्भुगतान हेतु अनुस्मारक]]></text>
</staticText>
<staticText>
<reportElement x="132" y="25" width="252" height="25" uuid="fa5e3e6e-26f7-4973-a2d5-3c3b7a5e8227"/>
<textElement textAlignment="Center">
<font size="16"/>
</textElement>
<text><![CDATA[Reminder for repaying Overdue Amount]]></text>
</staticText>
</band>
</title>
</jasperReport>
When I convert this to PDF, I do not get Hindi text. My code for converting to pdf is as follows:
public class PdfFromXmlFile {
public static void main(String[] args) throws JRException, IOException {
JasperReport jasperReport = JasperCompileManager
.compileReport("C:/report.jrxml");
Map<String, Object> parameters = new HashMap<String, Object>();
JRDataSource dataSource = new JREmptyDataSource();
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
parameters, dataSource);
File outDir = new File("C:/jasperoutput");
outDir.mkdirs();
JasperExportManager.exportReportToPdfFile(jasperPrint,
"C:/jasperoutput/report.pdf");
System.out.println("Done!");
}
}
How to fix it? I tried to create a jar with Lohit-Devanagarittf from JasperSoft Studio and imported it here, but that didn't work.
source
share