0
votes

I use knp_snappy to generate pdf with symfony2.

It's working well but I need to add footer/header. When I try to, wkhtmltopdf says that my version of qt doesn't have the wkhtmltopdf patches.

Is there's a way to patch qt without having to uninstall/reinstall wkhtmltopdf (The system is already used by clients, so it must keep working) ?

2

2 Answers

0
votes

Note: I'm unsure what you mean by 'qt', but you can specify where snappy looks for the wkhtmltopdf binary (as it says in its documentation) which enables you to choose to use whatever version you like.

In your config.yml file:

knp_snappy:
    pdf:
        enabled:    true
        binary:     /usr/local/bin/wkhtmltopdf #"\"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe\"" for Windows users
        options:    []
0
votes

I've tried numerous wkhtmltopdf versions and I came to the conclusion that the package h4cc/wkhtmltopdf-amd64 works best.

composer require h4cc/wkhtmltopdf-amd64

After that, you'll need to configure knp_snappy to use the newly installed binary:

knp_snappy:
    pdf:
        enabled:    true
        binary:     %kernel.root_dir%/../bin/wkhtmltopdf-amd64
        options:    []

Note that I've only tested this on Debian/Ubuntu.