Download the PHP package phppdf/phppdf without Composer
On this page you can find all versions of the php package phppdf/phppdf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phppdf/phppdf
More information about phppdf/phppdf
Files in phppdf/phppdf
Package phppdf
Short Description A pure PHP library for creating and processing PDF files.
License MIT
Homepage https://phppdf.github.io/phppdf/
Informations about the package phppdf
phppdf
phppdf is a pure PHP library for creating and processing PDF files. It covers both sides of the PDF workflow: a fluent builder API for generating documents from scratch, and a parser for reading, extracting content from, and modifying existing files.
The library maps closely to the PDF specification. Page content is built through a content stream API that exposes the full set of PDF graphics operators — paths, text, images, color spaces, gradients, transformations — while higher-level helpers (text flow, tables, barcodes, QR codes, SVG rendering) sit on top for common tasks. You get fine-grained control when you need it and convenience when you don't.
No composer dependencies are required beyond standard PHP extensions.
Requirements
- PHP 8.4+
ext-dom(svg)ext-gd(images)ext-libxml(svg)ext-mbstring(text encoding)ext-openssl(encryption and signing)ext-zlib(reading and writing)
Installation
Documentation
The documentation can be found here: https://phppdf.github.io/phppdf/
Quick start
Features
Building PDFs
Document structure
- Fluent document builder with pages, headers, footers, outlines, forms, and metadata
- PDF versions 1.0 – 2.0
- Stream compression (Flate/deflate)
- Page sizes: A0 – A5, Letter, Legal, Tabloid, and arbitrary custom dimensions
- Page rotation
- Global fonts and templates shared across all pages
- Output to memory buffer, file path, or any PHP stream resource
Fonts and text
- Standard Type 1 fonts (Helvetica, Times, Courier, Symbol, ZapfDingbats) — no embedding required
- Embedded TrueType and OpenType fonts, including TTC font collections
- Automatic glyph subsetting — only the glyphs used are written to the file
- Full Unicode support for embedded fonts, including non-Latin scripts
- All PDF text operators: character spacing, word spacing, horizontal scaling, leading, rise
- Text rendering modes: fill, stroke, fill+stroke, invisible, and clipping variants
TextBox— word-wrapped text block with left / centre / right / justify alignment, configurable leading, and overflow detectionTextFlow— automatically paginates aTextBoxacross as many pages as needed- TeX-based hyphenation
- Bulleted lists
Graphics and color
- Path construction: straight lines, cubic Bézier curves (all three operator variants)
- Path painting: stroke, fill (non-zero winding and even-odd), fill+stroke, clip
- Shape helpers: rectangle, circle, ellipse, rounded rectangle
- Full graphics state control: line width, cap, join, miter limit, dash pattern, flatness
- Grayscale, RGB, and CMYK colors for stroke and fill
- Named
Colorhelper with hex input, named colors, and mix/lighten/darken - Axial (linear) gradients with two-stop and multi-stop support
- Radial gradients
- Transparency and blend modes via graphics state dictionaries
- Transformation matrices: translate, rotate, scale, arbitrary
Images and media
- PNG images (RGB, RGBA, grayscale, indexed; alpha channel preserved as soft mask)
- JPEG images
- SVG subset: shapes, paths, groups, transforms, and fill/stroke
- QR codes (all versions, configurable error correction level and module size)
- Code 128 barcodes
- EAN-13 barcodes
Tables
- Arbitrary column widths
- Per-cell and default padding
- Outer and inner borders with configurable color and weight
- Background color per row or per cell
- Text color per cell
- Left / right / centre / justify text alignment per cell
- Top / middle / bottom vertical alignment per cell
- Column span and row span
- Per-cell font and size override
Interactive features
- URI links and internal page links
- Text, highlight, underline, square, and circle annotations
- Document outlines (bookmarks) with unlimited nesting depth
- AcroForms: single-line text fields, multi-line text areas, checkboxes, combo boxes
Compliance and security
- PDF/A archival conformance: levels 1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u — XMP metadata written automatically
- AES-128 encryption with separate user and owner passwords
- Granular document permissions: printing, copying, modifying, annotations, and more
- Digital signatures (PKCS#7 / CMS, SHA-256)
Marked content
- Tagged content regions for structure and accessibility workflows
- Marked content points
- Compatibility sections (BX / EX)
Reading PDFs
- Traditional cross-reference tables (PDF 1.0 – 1.4)
- Cross-reference streams (PDF 1.5+)
- Compressed object streams (ObjStm)
- Lazy object loading with in-memory cache
- Text extraction: CID/Type0 fonts via ToUnicode CMap; Type1 and TrueType via WinAnsiEncoding
- Image extraction for all XObject images on a page
- Annotation reading with URI extraction
- AcroForm field discovery: names, values, types, and option lists
- AcroForm filling via incremental update (leaves the original byte-range intact)
- Password-protected file opening (user password and owner password)
Document operations
- Merge multiple documents into one
- Add, remove, and reorder pages — from a compiled document or directly from a file on disk
- Insert pages from one document into another
- Rotate and crop pages
- Inject headers and footers into an existing built document
- Import pages from existing PDFs as Form XObjects (reusable templates)
- N-up imposition (2-up, 4-up, 9-up presets; custom grid and sheet size)
- PDF/A compliance validation with per-issue severity reporting
CLI
phppdf text— extract plain text from a filephppdf info— print version, page count, and metadataphppdf merge— combine multiple files into one
Writing PDFs
Page sizes
PdfPageSize provides named constants for standard page sizes. All values are in PDF user units (1/72 inch).
Fonts
Standard Type 1 fonts are referenced by name and require no embedding:
TrueType / OpenType fonts are fully embedded in the PDF. They support Unicode text including non-Latin scripts. Only the glyphs actually used in the document are embedded (subsetting is automatic):
Global fonts are registered once and available on every page, which is useful for headers and footers:
Text layout
TextBox measures and wraps a block of text within a fixed width. TextFlow automatically paginates overflowing text
across multiple pages.
TextAlign supports Left, Centre, Right, and Justify. Hyphenation is available via TeXHyphenator:
Lists
Drawing
All drawing uses the PDF graphics model — paths, fills, strokes, and transforms. Coordinates are in user units with the origin at the bottom-left of the page.
Colors
Stream color methods (setNonStrokingRgbColor, setStrokingRgbColor, etc.) take plain float values. The Color class
is used by table cells and other higher-level helpers.
Gradients
Images
PNG and JPEG images are supported via the GD extension.
Tables
SVG
A subset of SVG 1.1 is supported: basic shapes, paths, groups, transforms, and fills.
QR codes
Barcodes
Links and annotations
Outlines (bookmarks)
AcroForms
The form builder attaches interactive fields to the document. Field coordinates are in PDF page-space (origin at bottom-left, y increases upward).
Headers and footers
To inject headers/footers into an already-built PdfDocument, use PdfDocumentEditor:
Encryption
Digital signatures
PDF/A conformance
Supported levels: PdfA1b, PdfA1a, PdfA2b, PdfA2a, PdfA2u, PdfA3b, PdfA3a, PdfA3u.
Document metadata
Output targets
Reading PDFs
Open a document
Text extraction
Text extraction handles Type 0 (CID) fonts via ToUnicode CMap and simple fonts via WinAnsiEncoding. Complex custom encodings and purely glyph-substituted fonts may not extract correctly.
Image extraction
Annotation reading
Form reading and filling
Encrypted PDFs
Document operations
Merging documents
Note: encryption, digital signatures, and bookmarks from source documents are not carried over into the merged output.
Page management
PdfDocumentEditor accepts either a compiled PdfDocument or a file opened with PdfDocumentReader:
Template import
Import a page from an existing PDF as a reusable background (Form XObject):
N-up imposition
Arrange multiple source pages on a single output sheet:
PDF/A validation
CLI
The phppdf binary is installed to vendor/bin/phppdf by Composer.
License
MIT
All versions of phppdf with dependencies
ext-dom Version *
ext-gd Version *
ext-libxml Version *
ext-mbstring Version *
ext-openssl Version *
ext-zlib Version *