HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML Forums › Technical questions / Troubleshooting › Encoding problem › Reply To: Encoding problem
OMG, It helped, thank you.
Except for the last character: ā which is now: “�?”
Full output, with Windows fonts:
First Pageä|ä|á|ą|â|à|ả|ã|ạ|ă|ằ|ắ|ẳ|ẵ|ặ|ầ|ấ|ẩ|ẫ|ậ|å|�?
Full output, without Windows fonts:
First Pageä|ä|á|?|â|à|?|ã|?|?|?|?|?|?|?|?|?|?|?|?|å|??
I think that means, some fonts are missing, yes?
Where else I could get/download them?
Can I use “pd4ml.useTTF” function multiple times?
Working code:
PD4ML pd4ml = new PD4ML();
String html ="First Pageä|ä|á|ą|â|à|ả|ã|ạ|ă|ằ|ắ|ẳ|ẵ|ặ|ầ|ấ|ẩ|ẫ|ậ|å|ā";
byte[] myBytes = html.getBytes();
InputStream stream = new ByteArrayInputStream(myBytes);
pd4ml.useTTF("C:\\Windows\\Fonts", true);
pd4ml.readHTML(stream);
String output_path = "C:\\test\\zxccc.pdf";
try(OutputStream outputStream = new FileOutputStream(output_path)) {
pd4ml.writePDF(outputStream);
}
Desktop.getDesktop().open(new File(output_path));