intive-FDV / DynamicJasper

Dynamic Reports using Jasper Reports
http://intive-fdv.github.io/DynamicJasper/
GNU Lesser General Public License v3.0
241 stars 128 forks source link

Arabic Character not show in the PDF #117

Closed motazco135 closed 1 year ago

motazco135 commented 2 years ago

I The Library to generate simple table contains Arabic Characters in the Column Data (Example : "تجربه") now when export the report to PDF I see it empty .

the Font used Is Arial which is already added in the class path using DynamicJasper-core-fonts maven file .

code sample :

     private void createReportUsingDynamicJasper() throws ClassNotFoundException, JRException {
        FastReportBuilder reportBuilder = new FastReportBuilder();
        Page page = Page.Page_A4_Landscape();
        reportBuilder.setTitle("table title")
                .setPageSizeAndOrientation(page)
                .setUseFullPageWidth(true)
                .setReportName("report name ");
        List<String> columns = Arrays.asList("description");
        reportBuilder.addColumn( "description","description" , String.class.getName(), 30); 
        List rowsDataList = new ArrayList();
        for (int row = 0; row < 5; row++) {
            HashMap<String, String> rowHashMap = new HashMap<>();
            rowHashMap.put("description", "تجربه" );
            rowsDataList.add(rowHashMap);
        }
        DynamicReport dynamicReport = reportBuilder.build();
        dynamicReport.setReportLocale(new Locale("AR","sa"));

        JasperPrint finalReport = DynamicJasperHelper.generateJasperPrint(dynamicReport,
                new ClassicLayoutManager(), rowsDataList);

        JRPdfExporter pdfExporter = new JRPdfExporter();
        ExporterInput exporterInput = new SimpleExporterInput(finalReport);
        OutputStreamExporterOutput exporterOutput = new 
       SimpleOutputStreamExporterOutput("filename.pdf");
        pdfExporter.setExporterOutput(exporterOutput);
        pdfExporter.setExporterInput(exporterInput);

        SimplePdfReportConfiguration configuration = new SimplePdfReportConfiguration();
        configuration.setIgnoreHyperlink(true);
        pdfExporter.setConfiguration(configuration);
        pdfExporter.exportReport();
    }
motazco135 commented 2 years ago

It seems DynamicJasper-core-fonts.jar is not working or i may do something wrong , I removed the dependency and follow the steps in Taturial and add the jar file in the class path and it works fine now . I will leave the issue Open maybe someone have another thoughts about how to use DynamicJasper-core-fonts.jar with Spring boot Project

Note : I use Spring Boot

juanalvarezg commented 1 year ago

fixed, sorry for the late answer, please use core-fonts 2.1