Hey,

I need to use wkhtmltopdf in a project where large PDF with 1000 pages lead to timeouts with mpdf. With mpdf the generation took 7 minutes - with wkhtmltopdf it takes just 30 seconds.

The mpdf library handler module already offered the possibility to alter the created mpdf object. For wkhtmltopdf something like that is missing. In my situation I needed to change the paper size depending on the path where the PDF is created. By now this library handler module is very static in this point.

I will try to offer a patch in a short time for that.

Best,
Tobias

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tobiberlin’s picture

Here is a patch. Options are turned into an array so it might be good to save the default options as an array in variable 'print_pdf_wkhtmltopdf_options'?!

mortona2k’s picture

Status: Active » Needs review

I did a similar, but much simpler tweak, basically just this line:

drupal_alter('print_pdf_wkhtmltopdf_options', $wkhtmltopdf_options);

I was just trying to set wkhtmltopdf options based on the url. I can see how using arrays makes this much more manageable, and I hope we can get comment from module maintainers about saving the options variable as an array.

The patch diff looks sensible to me, hopefully someone else takes a deeper look.

jcnventura’s picture

Status: Needs review » Closed (duplicate)

Yes, something like #3053844: add hook for print_pdf_wkhtmltopdf seems saner at this stage of the process.