Proposed new hook: `hook_civicrm_pdfconfig`
Tonight I was working on differences in rendering output between domPdf
and wkhtmltopdf
. I ended up down quite the rabbit hole and found out that there's no reliable way to get certain settings (e.g. font size) to work reliably across different wkhtmltopdf
versions and even OSes.
We use the snappy
package, which is a PHP wrapper around wkhtmltopdf
, and I was able to solve my problem by hacking a core file to insert the line:
$snappy->setOption("zoom", 1.08);
However, this line can't be committed to core, since it will break folks with older versions of wkhtmltopdf
and probably Civi running on Windows/MacOS servers.
So instead I think a hook, which passes the snappy
(or DOMPDF
) object, is the best solution. I can write this if it's approved.