A Kimai plugin to use Dompdf as PDF renderer (in place of MPdf)
- Requires Kamai 2
- PDFs created by dompdf
- Much smaller PDFs
- Improved support for CSS 2.1 in templates
The bundle is in early stages, but appears to be working well. Not yet tested on release versions of Kimai.
Page numbering in templates needs to be positioned manually, with x and y co-ordinates, in an inline php script, due to how Dompdf counts the total number of pages. See the script at the bottom of the provided default template
First unzip the plugin into to your Kimai plugins
directory:
unzip DompdfRendererBundle-x.x.zip -d <kimai path>/var/plugins/
And then reload Kimai:
bin/console kimai:reload
DompdfRendererBundle has one dependency (i.e. dompdf), which I thought should be installed automatically with the above command, but for some reason dompdf wasn't installing automatically for me. So, while in the top level folder, run the following command to install dompdf:
composer require dompdf/dompdf
The plugin should appear, and will now be used as the PDF renderer instead of MPdf.
To disable the dompdf backend, either:-
- Edit Resources/config/dompdf_config.yaml, changing the
renderer
value tompdf
(or anything other thandompdf
) - Set the environment variable
KIMAI_PDF_RENDERER
to something (anything other thandompdf
).
Then, reload Kimai again:
bin/console kimai:reload
New twig templates can be added to /Resources/invoices
. An example is provided, based on Kimai's default template.