Docx report with embeded Custom Font convertion to PDF using Unoconv
-
Hello!
I'm using DOCX recipe to generate the report. Conditionally I'm adding properties to request to convert it to PDF. I have to use custom fonts in the report. Fonts can't be installed on the jsreport server cause it's problematic to deploy custom images to Azure. So I'm embeding them into docx template. And it works perfectly for docx format generation. But when it comes to PDF some fonts do work (preserved after conversion to PDF) and some of them don't (PDF uses some default fonts and report looks bad).
Do you have possible suggestions / solutions?Thank you in advance for help and for developing this tool!
-
I don't have a lot of experience in this. However, the unoconv calls the LibreOffice for docx -> pdf conversion and it will be needed to isolate the issue if it's unoconv or LibreOffice issue. Try to open the docx in LibreOffice and use its menu to convert to PDF. Do you experience the same font issue in the PDF exported directly from the LibreOffice app? In this case, try to search the LibreOffice repo issues with the particular font, maybe you find a workaround.
-
Thank you for the response!
I tried to Export (generated to docx report) Directly as PDF in the LibreOffice Writer (libreoffice 24.2.2.2) and the font is successfully preserved.
So now it looks like the unoconv's issue, right?
Could you suggest some steps to deal with the unoconv issues?
Thank you
-
Ups, I didn't think through you can't run this test on the same machine where you intend to host jsreport...
Anyway, the unoconv is just a wrapper for the LibreOffice API, its source can be found here
https://github.com/unoconv/unoconv/blob/master/unoconv
There could be a problem with some config, but I gues the problem is somewhere else...If you run jsreport on the same machine as this test, I guess it will work as well right?
In this case, it would mean that LibreOffice is still using OS machine fonts even when you embed it.Fonts can't be installed on the jsreport server cause it's problematic to deploy custom images to Azure.
What Azure service do you use? Perhaps you can deploy with Docker and build an image with the requested fonts.