I'm trying to export a report to pdf format using dynamic reports but the persian characters do not appear in pdf file. but I don't have this problem in xls files or jasper viewer. i have tried this method but it doesn't work. what should i do?
public void toPdf(String path){
JasperPdfExporterBuilder pdfExporter = new ExporterBuilders()
.pdfExporter(path);
pdfExporter.setCharacterEncoding("UTF-8");
try {
jasperReportBuilder.toPdf(pdfExporter);
} catch (Exception e1) {
logger.error("failed to create PDF", e1);
}
}
excel export :
jasper viewer :
PDF export :
I had the same problem and managed to solve it. You can follow my answer here. The devil is the way you handle fonts. Use this tutorial and change your encoding in fonts.xml to
Identity-H
(it is case sensitive!)