ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Wkhtmltopdf 0.12.3 SSL Errors on Debian 9


#1

When i install frappe and erpnext with the easy install scipt, wkhtmltopdf is installed in Version 0.12.3 which causes problems if you use https.

Seems its due the usage of old SSL protocols like SSLv3 which aren`t supported anymore.

States that “wkhtmltopdf has been locked down to 0.12.3 intentionally since 0.12.4 has problems.”

But the manual Install guide says:

“wkhtmltopdf (version 0.12.5) (for pdf generation)”

Which would match with this recommendation:

So i replaced the installed version with 0.12.5 from:

https://wkhtmltopdf.org/downloads.html

The PDF generation does not run into ssl errors anymore, but the font size is smaller then with 0.12.3, which could have something todo with https://github.com/wkhtmltopdf/wkhtmltopdf/issues/3241

But since the manual install suggests 0.12.5 my question is: is there a way to get the corret font size?


#2

Try adding in xfonts-75dpi like this (also added in a couple of lines about the update…)

sudo apt install xfonts-75dpi -y
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb
dpkg --install wkhtmltox_0.12.5-1.stretch_amd64.deb


#3

Thanks for your reply.
I allready had xfonts-75dpi and wkhtmltox_0.12.5-1.stretch_amd64.deb installed. So this brought no changes for me.


#4

As i have seen, since wkhtmltopdf 0.12.4 dpi was somehow hardcoded zo 96. So for me the solution was to set settings to: dpi 75 and zoom 1.28 (i.e. 96/75), which produces almost identical output.

As seen on https://github.com/wkhtmltopdf/wkhtmltopdf/issues/3241

i did this by changing ./apps/frappe/frappe/utils/pdf.py from line 61 to the following:

def prepare_options(html, options):
    if not options:
            options = {}

    options.update({
            'print-media-type': None,
            'background': None,
            'images': None,
            'quiet': None,
            # 'no-outline': None,
            'encoding': "UTF-8",
            #'load-error-handling': 'ignore',

            # defaults
            'margin-right': '15mm',
            'margin-left': '15mm',
            #options for wkhtmltopdf 0.12.5
            'zoom': 1.28,
            'dpi': 75
    })