A ProcessWire module for generating PDF documents from pages with mPDF or Dompdf. It supports UTF-8/Cyrillic text, configurable typography, headers, footers, watermarks, password protection, and common ProcessWire field types including ProFields.

Version: 3.0.1
Author: Maxim Semenov
Website: smnv.org
Email: maxim@smnv.org
If this project helps your work, consider supporting future development: GitHub Sponsors or smnv.org/sponsor.
Formerly published as WirePDF. The module was renamed to PagePdf in 3.0.0 to avoid confusion and upgrade collisions with the legacy WirePDF class bundled in Pages2Pdf.
Features
- Convert ProcessWire pages to PDF with
$page->toPdf() - Render PDF output as a string with
$page->renderPdf() - Save PDFs directly to disk with
$modules->get('PagePdf')->savePdf() - Use mPDF by default, with Dompdf available as an optional engine
- Configure paper size, orientation, margins, font, image DPI, headers, footers, and watermarks
- Add PDF password protection and copy/print restrictions
- Use the included Setup -> PagePdf Wizard admin page for guided setup
- Generate PDFs from raw HTML, a custom template file, or full page rendering
Requirements
- ProcessWire 3.0 or later
- PHP 8.0 or later
- Composer
- mPDF library, installed with
composer install
Quick Start
- Clone the module into
/site/modules/PagePdf/. - Run
composer install inside the module directory. - In ProcessWire admin, go to Modules -> Refresh.
- Install PagePdf.
- Open Setup -> PagePdf Wizard and create the generator template/page.
- Generate a PDF:
$page->toPdf([
'filename' => 'document.pdf'
]);
Documentation
Basic Example
$page->toPdf([
'filename' => 'report.pdf',
'paper_size' => 'A4',
'orientation' => 'landscape',
]);
License
MIT License - free to use in commercial and non-commercial projects.
Credits