-
Notifications
You must be signed in to change notification settings - Fork 38
Home
Imal Perera edited this page Jan 2, 2026
·
2 revisions
PDFLib is a modern, driver-based PHP library for manipulating PDF files. It provides a unified, fluent API to handle complex PDF operations by leveraging powerful underlying tools like Ghostscript, Google Chrome, OpenSSL, and PDFtk.
The PHP ecosystem for PDF manipulation is fragmented:
-
Generation:
dompdforwkhtmltopdf(legacy). -
Manipulation:
fpdiportcpdf(complex, legacy codebases). -
Previews:
spatie/pdf-to-image(limited scope).
PDFLib v3 aims to solve this by being the "One API to rule them all". It decouples the Interface (Fluent API) from the Implementation (Drivers), allowing you to swap backends without changing your code structure.
- HTML to PDF: High-fidelity rendering using Chrome/Chromium.
- Manipulation: Merge, Split, Rotate, Watermark, Compress, Encrypt (via Ghostscript).
- Digital Signatures: Sign PDFs securely with X.509 certs (via OpenSSL/TCPDF).
- Interactive Forms: Fill and Flatten AcroForms (via PDFtk).
- Modern DX: PHP 8.1+, Strict Types, Facade-based or Dependency Injection usage.
Get Started with Installation →
- Ghostscript Driver - Logic for Conversion, Merge, Split, etc.
- Chrome Headless Driver - HTML to PDF Conversion.
- OpenSSL Driver - Digital Signatures.
- PDFtk Driver - Form Filling and Flattening.