64-bit PHP 8.3+ · PDF 1.7 and 2.0

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
6 615documented components
630ISO and Adobe dictionaries
44PDF 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 →
Preview: PDF 2.0 and associated files
Tutorial 27

PDF 2.0 and associated files

UTF-8 metadata, AF files and named MCAF properties.

Read and view the PDF →
Preview: Metadata, declarations and document parts
Tutorial 28

Metadata, declarations and document parts

XMP, declaration scope, black point compensation and DPart.

Read and view the PDF →
Preview: A wrapper for an encrypted PDF
Tutorial 29

A wrapper for an encrypted PDF

Hidden collection, EncryptedPayload associated file and content protection.

Read and view the PDF →
Preview: Namespaces and well-tagged PDF
Tutorial 30

Namespaces and well-tagged PDF

Qualified roles, inclusion rules and WTPDF audit report.

Read and view the PDF →
Preview: Modern algorithms and PDF integrity
Tutorial 31

Modern algorithms and PDF integrity

Independently verified SHA-3 signatures, AES-GCM and PDF MAC.

Read and view the PDF →
Preview: Timestamps and validation evidence
Tutorial 32

Timestamps and validation evidence

RFC3161, signed revisions, explicit DSS and VRI.

Read and view the PDF →
Preview: Geospatial objects and measurements
Tutorial 33

Geospatial objects and measurements

Coordinate systems, paired points, viewports and point clouds.

Read and view the PDF →
Preview: Destinations targeting logical structure
Tutorial 34

Destinations targeting logical structure

Semantic targets, content traversal and fallback page destinations.

Read and view the PDF →
Preview: Derive HTML from tagged PDF
Tutorial 35

Derive HTML from tagged PDF

Logical structure, Unicode content and semantic HTML with explicit diagnostics.

Read and view the PDF →
Preview: Apply redaction
Tutorial 36

Apply redaction

Conservative data removal and writing a fresh file.

Read and view the PDF →
Preview: Fill a certified form
Tutorial 37

Fill a certified form

DocMDP, FieldMDP and isolated variable-text appearance replacement.

Read and view the PDF →

A PDF core, optional modules

The core represents the objects and mechanisms in the Adobe specification. PDF reading and image or font conversion modules depend on the core. The OpenType and PHP codec models are independent and install without any PDF package.

Choose packages and understand their scope →

Optional module · 0.8.1

pdftoolkit/pdf-reader

144 components

Package guide →

API reference →

Install with Composer · Packagist ↗

Optional module · 0.2.3

pdftoolkit/pdf-images

24 components

Package guide →

API reference →

Install with Composer · Packagist ↗

Optional module · 0.2.1

pdftoolkit/pdf-fonts

24 components

Package guide →

API reference →

Install with Composer · Packagist ↗

Optional module · 0.4.1

pdftoolkit/opentype

260 components

Package guide →

API reference →

Install with Composer · Packagist ↗

Optional module · 0.8.4

pdftoolkit/pdf-to-html

120 components

Package guide →

API reference →

Install with Composer · Packagist ↗

Optional module · 0.1.1

pdftoolkit/pdf-codecs

85 components

Package guide →

API reference →

Install with Composer · Packagist ↗

Optional module · 0.4.0

pdftoolkit/html-to-pdf

101 components

Package guide →

API reference →

Install with Composer · Packagist ↗

Three ways to explore the project