Hi,
the TestArchiveCreator plugin by Institut für Lern-Innovation Friedrich-Alexander-Universität Erlangen-Nürnberg lists some useful advice on using phantomJS with ILIAS for PDF generation. To quote from their README:
Please look at the PhantomJS web site for general installation instructions. Short hint for Debian based systems (thanks to Rachid Rabah): apt-get install phantomjs
PhantomJS will be located in /user/bin/phantomjs
Set the following environment variables: export QT_QPA_PLATFORM=offscreen
export QT_QPA_FONTDIR=/usr/share/fonts/truetype
If you need a font with Japanese characters: apt-get install fonts-takao
You may also take binary distribution fom https://bitbucket.org/ariya/phantomjs/downloads/
PhantomJS 2.1.1 is the preferred one, but renders web fons as graphis which results in large, unsearchable PDFs. You may prevent this by deactivating 'Use System Styles' in the plugin configuration, but this leads to ugly output.
PhantomJS 1.9.8 is able to render web fonts, so 'Use System Styles' can be activated. But this older version seems to have some problems with ssl and images, so you should set 'Any SSL Protocoll', 'Ignore SSL Errors', and 'Render Twice" in the plugin configuration.
We set those env variables in a Docker Entrypoint. If you run on bare metal or VM, make sure these env variables are visible to your web server. There is also a section about the Web Access Checker (in case images are missing from PDFs) and Debugging of the PDF generation. In reading and following their advice, our PDF generation issues been have almost gone.