Question

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 : excel export

jasper viewer :

jasper viewer

PDF export : enter image description here

Was it helpful?

Solution

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!)

OTHER TIPS

I am using dynamic jasper API and whenever the PDF file name i am exporting into Linux server it gets changed if it contains German umlauts character like ä even though i am taking encoding as UTF-8 or ISO-8859-14,ISO-8859-15,ISO-8859-1 etc.

changed ä to ä in dynamic jasper API(JasperConcatenatedReportBuilder) while exporting the PDF.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top