PHP 8.3+ · PDF 1.7 · ISO 32000-1

The PDF format.
Object by object.

Understand structures, compose objects and control the bytes. Explore the format and build your own PDF files.

01 / entry pointDocumentCatalog
02 / document treePageTreeNode
03 / content & resourcesPageObjectStreamObject · ResourceDictionary
3 303documented components
324ISO and Adobe dictionaries
27PDF examples to explore
73PDF operator tokens

Learn with objects

Build a document and explore its pages

Each tutorial connects the explanations to PHP objects and the PDF being created or read. Explore its pages, script and execution result.

Preview: First document
Tutorial 01

First document

Font, content, page and catalog.

Read and view the PDF →
Preview: Pages and text
Tutorial 02

Pages and text

Shared resources, inheritance and explicit lines.

Read and view the PDF →
Preview: Drawing and transformations
Tutorial 03

Drawing and transformations

Paths, colours, curves and matrices.

Read and view the PDF →
Preview: Bookmarks and destinations
Tutorial 04

Bookmarks and destinations

A hierarchical outline and named destinations.

Read and view the PDF →
Preview: Clickable links
Tutorial 05

Clickable links

Internal annotations and URI actions.

Read and view the PDF →
Preview: Images
Tutorial 06

Images

An RGB pattern as an XObject and an inline image.

Read and view the PDF →
Preview: Gradient and function
Tutorial 07

Gradient and function

A type 2 function drives axial shading.

Read and view the PDF →
Preview: Compressed objects
Tutorial 08

Compressed objects

Filters, object streams and cross-references.

Read and view the PDF →
Preview: TrueType font and Unicode
Tutorial 09

TrueType font and Unicode

Embedded program, CID, metrics and Unicode mapping.

Read and view the PDF →
Preview: JPEG and PNG images
Tutorial 10

JPEG and PNG images

Image files, colours, samples and transparency.

Read and view the PDF →
Preview: Incremental revisions
Tutorial 11

Incremental revisions

Preserved bytes, explicit replacements and chained cross-references.

Read and view the PDF →
Preview: Reading pages from an external PDF
Tutorial 12

Reading pages from an external PDF

Validated tree, inherited attributes and explicitly decoded streams.

Read and view the PDF →
Preview: Adobe extensions and Bates numbering
Tutorial 13

Adobe extensions and Bates numbering

Extension declarations, artifacts and document numbering.

Read and view the PDF →
Preview: AcroForm fields and appearances
Tutorial 14

AcroForm fields and appearances

Field trees, widgets, values and appearances.

Read and view the PDF →
Preview: Logical structure and tagged content
Tutorial 15

Logical structure and tagged content

Reading order, MCID, ParentTree and annotation links.

Read and view the PDF →
Preview: Linearization
Tutorial 16

Linearization

Physical object order, dependencies and binary hints.

Read and view the PDF →
Preview: Colours, patterns and gradients
Tutorial 17

Colours, patterns and gradients

Colour spaces, repeated cells and seven shading types.

Read and view the PDF →
Preview: CMaps and Unicode
Tutorial 18

CMaps and Unicode

Composite encoding, CID, UseCMap and Unicode extraction.

Read and view the PDF →
Preview: Filters and predictors
Tutorial 19

Filters and predictors

LZW and TIFF/PNG row prediction before compression.

Read and view the PDF →
Preview: PDF signatures
Tutorial 20

PDF signatures

Reserved Contents, ByteRange and an explicit CMS signature.

Read and view the PDF →
Preview: Images, transparency and layers
Tutorial 21

Images, transparency and layers

Bit depths, masks, groups, ExtGState and optional content.

Read and view the PDF →
Preview: Native fonts and vertical writing
Tutorial 22

Native fonts and vertical writing

Type3, simple fonts, PDF programs and vertical metrics.

Read and view the PDF →
Preview: Navigation, articles and presentation
Tutorial 23

Navigation, articles and presentation

Labels, viewports, article rings and sequences.

Read and view the PDF →
Preview: Embedded files and collections
Tutorial 24

Embedded files and collections

Bytes, metadata, EF/RF/CI and collection presentation.

Read and view the PDF →
Preview: Deletion and generations
Tutorial 25

Deletion and generations

Free list, reuse and historical identities.

Read and view the PDF →
Preview: Signature field policy
Tutorial 26

Signature field policy

Seed values, lock, appearance and evidence of the actual signed result.

Read and view the PDF →

A PDF core, optional modules

The core represents the objects and mechanisms in the Adobe specification. Reading external PDFs and converting image or font files are optional dependencies: each module depends on the core.

Choose packages and understand their scope →

Optional module · 0.1.6

pdftoolkit/pdf-reader

41 components

Package guide →

API reference →

Install with Composer · Packagist ↗

Optional module · 0.1.6

pdftoolkit/pdf-images

9 components

Package guide →

API reference →

Install with Composer · Packagist ↗

Optional module · 0.1.6

pdftoolkit/pdf-fonts

13 components

Package guide →

API reference →

Install with Composer · Packagist ↗

Three ways to explore the project