HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML Forums › Technical questions / Troubleshooting › Encoding problem › Reply To: Encoding problem
Unfortunately we had no success to reproduce the original as well as the last issues you reported.
I would suspect you saved the source Java file as UTF-8, but your build assumes another default Java source encoding (passed as -encoding param of javac or inherited from the OS). It would somehow explain the oddities you faced with, but there are still questions open.
To omit the build environment dependency and to match typical PD4ML usage scenarios, save the text or HTML content to an external file and refer to it from the Java code.
FYI: the ‘true’ parameter in pd4ml.useTTF("C:\\Windows\\Fonts", true)
to reindex all system fonts with every conversion call – it is not a good idea from performance perspective. Index once and reuse the font mapping data. See https://pd4ml.tech/pdf-fonts/
You may call pd4ml.useTTF()
multiple times, but I guess the wrong rendering of the last char is because of a missing font – it is something wrong with encodings.