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.

As pixel‑perfect or as simple as you want to be.

01

Build

A one-page PDF is a few lines. Or hand it HTML and let it do the work for you.

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

Import

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

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

Pdf::writeToFile($doc, 'out.pdf');
Import and modify PDFs
Merge PDFs
Open a protected PDF
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', pages: [1, 2, 3]
);

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

One install, that's it.

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

$ composer require popphp/pop-pdf