JasperReports font problem for Indian language
I am designing a report with some marathi (Indian language) words. iReport's internal and HTML preview work. The PDF view, however, does not work.
There may be some error on the PDF side, or may an error in iText.jar
.
Then i used this java code. The report uses freesans.ttf font with the following code:
JRReportFont font = new JRDesignReportFont();
font.setPdfFontName("FreeSans.ttf");
font.setPdfEncoding(com.lowagie.text.pdf.BaseFont.IDENTITY_H);
font.setPdfEmbedded(true);
jasperPrint.setDefaultFont(font);
pdfExpoter.setParameter(JRPdfExporterParameter.JASPER_PRINT, jasperPrint);
pdfExpoter.setPara开发者_Python百科meter(JRPdfExporterParameter.CHARACTER_ENCODING, "UTF-8");
pdfExpoter.setParameter(JRPdfExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
pdfExpoter.exportReport();
At least it showed the marathi words. But the words are not displayed properly (they break and the alignment is poor).
What must I do to:
- Display the PDF?
- Fix the alignment?
Thank you!
Yes the issue is due to export()
method, in Indic scripts there are some word while printing them we need to move left-right and reverse. this causes the issue.
Somebody has used OpenOffice's exporter and hosted a newer version of Jasper Report , Check it indic-jasper
Make a jar of files under ireport4.0.2/ireport/fonts and add it to your classpath if you get an arror says like "JVM can't find the font".
精彩评论