skip to Main Content

I’m currently having a problem with the fonts when I generate a PDF with wkhtmltopdf in Centos 7 on a normal hosting account. However, when I create the PDF in root I get no errors.

The error that I’m getting is:

Fontconfig error: Cannot load default config file

I checked the /etc/fonts/fonts.conf and it exists and it also has read privileges for everyone and I dont know what else coould be going on taking in account that it is working for root and not for the sub accounts.

The code I am using to generate the PDF:

wkhtmltopdf /rout/to/my.html /rout/to/my.pdf

The main problem is that the fonts aren’t rendering and we always get the "Sans Serif" font as default. But the funny thing is that if I put the font as bold, it does render with the type of font that I need. In this case it’s "Verdana".

Thanks in advance.

2

Answers


  1. Chosen as BEST ANSWER

    Ok, so in my particular problem, it was not working because the hosting account had a "Jailed Shell" instead of a "Normal Shell".

    This option can be changed in WHM for any specific account in the option "Manage Shell Access".

    Hope this helps people in the future.


  2. I had faced this problem with AWS Lambda today which is AWS Linux but cent OS from inside. Also, I found and successfully solved this problem so I think I should contribute to the community by answering this here.

    First, it can be checked that if the font are available for that user, if not you can give path and provide your app fonts.

    An easy to deploy implementation of HTML-pdf for AWS Lambda

    But any phantom/wkhtmltopdf code throws Error: write EPIPE Next on this link all the required dependencies are posted which I think should be listed somewhere but aren’t except this one. Also, the configuration is clearly explained

    Aws Lambda PhontomJS dependencies for amazon Linux 2

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search