Jasper Report PDF Encoding
You can also set "net.sf.jasperreports.default.pdf.encoding" in code like this:
JRProperties.setProperty("net.sf.jasperreports.default.pdf.encoding", "Cp1250");
Update
From the comment: 6 years later, the correct way to display character in Jasper Reports is using font-extensions, e.g. see https://stackoverflow.com/a/33941102/254109
Original answer
Make a file jasperreports.properties
, put it in the class path and set the PDF encoding.
net.sf.jasperreports.default.pdf.encoding=Cp1250
Or make base style in a report, set what you need, and all other styles derive from this style, i.e. they have an attribute style="base".
You have to embed UTF-8 fonts in the PDF.
- get the utf-8 fonts and place them on your classpath
- for older jasper-reports version use a custom
style
and apply it to all texts - before printing, call
style.setPdfFontName("/com/package/fonts/times.ttf")
;
For newer versions the PdfFontName
is deprecated instead of another way of doing this, but I can't find it now - look it up yourself.
Another workaround might be found here