Please give a brief summary of your issue:
Converting html to pdf through webviewer server and fallback font working
Please describe your issue and provide steps to reproduce it:
We are converting html to pdf through webviewer server by using API’s. We are first uploading the html file to server and then using “GetPDF” API to convert to PDF. It does the job however there are some fonts which we want to fallback to some “Default” font lets say “Arial”.
I have added some fonts in /usr/share/fonts/truetype
and added fonts.json containing fallback font in /usr/share/fonts
{
“target”:“arial1”,
“type”:“All”
}
but its not working.
Html
<p style="margin:0px 0px 0.3em;"><span style="font-family:abc;">Test comic sans - default </span></p>
This text is not getting converted to default font as provided in fonts.json file.
The current defaults to Times New Roman… which is not as per the rules defined in fonts.json. We don’t want to show the text in PDF in Times New Roman.
I am not sure how its picking the default as Times New Roman ?
WebViewer Server uses fonts based on what are installed on the docker container, and does not accept external font links or paths. Given that Arial is a windows font, it would not be installed with the docker. You would have to install it via a custom Dockerfile or flags yourself. You can find out how to do that via this FAQ.
WebViewer Server does not respect fonts.json and currently provides no way to use that file. fonts.json is meant only as a solution for client side rendering only (no WebViewer Server).