I using Jasper to export PDF file in java spring. First, I created report template in Jasper studio, change font as I expect and it display seem good. After that, I use this .jrxml template to export PDF file in java, but the problem is the font of this file is not corresponding to font I have configured. I have tried to change config font in template but it seem not have any effect on java application.
This lead to error when I use Vietnamese like that:
original text: "Chi phí phát triển thuê bao mới"
rendered text: "Chi phí phát trin thuê bao mi"
This is my java code:
public static void createPdfReport() {
try{
final InputStream stream = new FileInputStream(new File("/home/abc/JaspersoftWorkspace/MyReports/test_table.jrxml"));
final JasperReport report = JasperCompileManager.compileReport(stream);
final Map<String, Object> parameters = new HashMap<>();
List<Employee> employees = getSource();
JRBeanCollectionDataSource itemsJRBean = new JRBeanCollectionDataSource(employees);
parameters.put("ItemDataSource", itemsJRBean);
// final JRBeanCollectionDataSource source = new JRBeanCollectionDataSource(getSource());
final JasperPrint print = JasperFillManager.fillReport(report, parameters, new JREmptyDataSource());
final String filePath = "/home/abc/Documents/Draft/";
JasperExportManager.exportReportToPdfFile(print, filePath + "test.pdf");
} catch (Exception e) {
e.printStackTrace();
}
}
Can anyone give me a clue to fix that?