Server-side PDF printing
Please contribute! This document is a stub. If you have recently implemented a PDF generator that works well with modern WordPress in Seravo’s environment, please contribute to this page via the Github link in top right corner.
Traditionally developers have generated PDF files out of HTML web pages on the server side using one of the tools below. Unfortunately, none of them meet modern standards anymore.
- PHP-DOMPDF: Works only with PHP 5. Is not maintained anymore.
- PHP-FPDF: Works only with PHP 5 and is not maintained anymore. Anyway needed Apache and suexec to run, so was never a good option.
- wkhtmltopdf: Uses webkit for rendering and thus does not render correctly all modern websites. Needs X virtual framebuffer which is inconvenient server-side.
For modern WordPress sites there are three recommended options:
- Render PDF files server-side using the headless Chrome available in Seravo’s environments
- Use an custom WordPress plugins for the purpose (e.g. Waterwoo for watermarks) or external service via API requests
The standard WordPress media library automatically generates thumbnail images of the PDF files uploaded there. Unlike the above, the media thumbnails are not a HTML-to-PDF generation but rather a PDF-to-PNG generating using the GraphicsMagick library on the server and in PHP. Seravo’s servers support this feature out-of-the-box, just like our systems support every single other standard WordPress feature.