I use openhtmltopdf library (version: 0.0.1-RC15). I have a problem with unicode characters. In PDF file I see "#" symbols instead of "ă" and "ș". How I can fix it? Thank you.
Unicode character Issue - openhtmltopdf library
3.5k Views Asked by Taras Melnyk At
2
There are 2 best solutions below
0
On
I am using openhtmltopdf library. I had character problem too. Turkish characters looks like (İÖĞ -> ###). People already say its about font problem.
I add useFont method like this and download tff file in resource/fonts/
PdfRendererBuilder builder = new PdfRendererBuilder();
builder.useFont(new File(Main.class.getClassLoader().getResource("fonts/ARIAL.TTF").getFile()), "Arial");
In case it helps, we're using
com.openhtmltopdf:openhtmltopdf-pdfbox:1.0.10and have found a way that works:In the html we have a
<style>element that declares some css for the page, in particular:Unicode characters then display as they should.