Closed nero404 closed 2 months ago
Currently there is no built-in way to do this as we never had this situation before.
AFAIK PDFs have no classic "encoding" as have text files: https://stackoverflow.com/a/42118616
According to the PDF spec there can be certain string encodings.
In JasperReports you can do it like this, but it's recommended to use Fonts with the correct encoding instead.
Thank you very much. The problem solved by overriding the property values.
@Configuration
public class JasperReportsConfig {
@Bean
public JasperReportsContext jasperReportsContext() {
JasperReportsContext jasperReportsContext = DefaultJasperReportsContext.getInstance();
JRPropertiesUtil.getInstance(jasperReportsContext).setProperty("net.sf.jasperreports.default.pdf.encoding", "Identity-H");
JRPropertiesUtil.getInstance(jasperReportsContext).setProperty("net.sf.jasperreports.default.pdf.font.name", "fonts/arial.ttf");
return jasperReportsContext;
}
}
Checklist
What is/are your question(s)?
Is there a simple way to change the encoding format in PDF export? Adding EncodingConfigComponent to PdfFormat does not work.
Thanks for the answer.
Additional information
No response