I use JasperReports and DynamicReports with this piece of java code to generate a pdf report that contains utf-8 characters, the problem is that the pdf file does not contain utf-8 characters at all, as if they were replaced with "" . is there anything i need to know when using OutputStream to create a utf-8 file?
public void toPdf(String path){
OutputStream outHtml;
try {
outHtml = new FileOutputStream(path);
jasperBuilder.toPdf(outHtml);
} catch (Exception e1) {
logger.error("failed to create PDF", e1);
}
}
it may be noteworthy that creating XLS and HTML files does not encounter such a problem.
Note that there are many lines of code under jasperBuilder.toPdf(outHtml);that I have traced, and no where utf-8 characters are removed in these lines. so I guess the devil is inoutHtml = new FileOutputStream(path);