Wow! Report using Vietnamese!

Haha!

Copy font Unicode to classpath of IReport, set properties of PDF Font to Arial, Encoding to H-Unicodde, that’s all!

In Netbeans, point classpath to Font Unicode Folder.

Remember, using .jasper file when using JasperFillManager , if you want to use .jrxml, please compile it first.

so fun! I’m very happy about Jasper Report!

Code examples:

public void createServletReport(String fileName, String reportname, Map parameters, Connection con, HttpServletResponse response){
try{
JasperPrint print = JasperFillManager.fillReport(reportDir + File.separator + fileName, parameters, con);

OutputStream ouputStream = response.getOutputStream();

JRExporter exporter = null;

response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment; filename=\""+reportname+"\"");
exporter = new JRPdfExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);

exporter.exportReport();
}catch(Exception e){
System.out.println(e);
}
}
Advertisements