A standalone PDF library for PHP.

Working with PDFs in PHP usually means collecting libraries. One writes documents but can’t read them. Another reads but can’t write. A third renders HTML. A fourth merges.

Pop PDF does all of it — through one object model, one API, one dependency.

$ composer require popphp/pop-pdf
See the code →
PHP 8.4+ · BSD-3-Clause · in development since 2009
The usual stack
a generator library writes, can’t read
a parser library reads, can’t write
an HTML renderer one job
a merge utility one job
Four dependencies. Four release cycles to manage.
Or, just one
Pop PDF
Many features. One object model.
01

Build

A one-page PDF is eight lines. The same objects scale to a 400-page catalog.

generate.php
$page = $doc->createPage(Page::LETTER);
$page->addText(
    new Text('Hello', 12),
    Font::ARIAL, 50, 742
);
Simple & advanced document generation
Simple & complex fonts
Annotations & links
Drawing paths
HTML‑to‑PDF
Forms
/build →
02

Import

An imported PDF comes back as the same objects you would have built yourself.

modify.php
$doc = Pdf::importFromFile(
    'contract.pdf', [2, 4, 6]
);

Pdf::writeToFile($doc, 'out.pdf');
Import and modify PDFs
Merge PDFs
Build a PDF from images
/import →
03

Extract

Native text extraction, embedded fonts included — and a way to spot a scan before you read it.

extract.php
$text = Pdf::extractTextFromFile(
    'report.pdf', [1, 2, 3]
);

Pdf::isImageOnlyDocument('scan.pdf');
Extract text
Image‑only detection
Extract as images
/extract →

One install, all of it.

PHP 8.4+. Optional extensions: gd, imagick, zlib, mbstring.

$ composer require popphp/pop-pdf