Skip to content

Design Philosophy

TCPDF-Next is inspired by TCPDF but is a complete ground-up rewrite for the modern PHP era. It is not a fork, not an incremental upgrade — it is an entirely new library built on next-generation architecture.

The original TCPDF served the PHP community well for over a decade. But its single-file, 30,000-line architecture cannot support the demands of modern PDF generation: PDF 2.0 compliance, PAdES digital signatures, PDF/A-4 archival, or integration with frameworks like Laravel.

TCPDF-Next keeps the concepts PHP developers know — addPage(), cell(), setFont() — while rebuilding everything underneath to meet 2026 standards.

At a Glance

Original TCPDFTCPDF-Next
PHP version5.x – 8.x8.5+ only
PDF spec1.4 – 1.72.0 (ISO 32000-2:2020)
ArchitectureSingle ~30K-line class213 files, 26 modules, 12 composable traits
Type safetyNonePHPStan level 8, backed enums, readonly classes
SignaturesBasic PKCS#7PAdES B-B (Core) → B-LTA (Pro)
ArchivalPDF/A-1b (partial)PDF/A-4 (ISO 19005-4:2020)
HTML renderingBuilt-in (limited CSS)Built-in + Chrome CDP (full CSS3)
Testing~50 tests908+ tests, 28,881+ assertions
ExtensibilitySubclass monolithModular ecosystem + extension API

Ecosystem Architecture

TCPDF-Next is not a monolith. It is a modular ecosystem of four packages, each with a clear responsibility:

TCPDF-Next
Core
Artisan
Chrome CDP
Laravel
Framework
Pro
Enterprise
  • Core (148 files) — The PDF engine. Everything you need for document generation, typography, barcodes, encryption, and PAdES B-B signatures.
  • Artisan (17 files) — Chrome CDP integration for pixel-perfect HTML/CSS3 rendering. Text-selectable PDF output via Form XObjects, not rasterized images.
  • Laravel (4 files) — Zero-config framework integration. Facade, HTTP responses, queue jobs, Octane-safe bindings.
  • Pro (47 files) — Enterprise features. PAdES B-T through B-LTA, PDF/A-4, HSM signing, specialty barcodes.

The extension API is open: third-party developers can build their own extensions that hook into Core through the published interfaces (PdfDocumentInterface, SignerInterface, FontManagerInterface, HsmSignerInterface).

The 12 Composable Traits

The Document class is the single entry point. Instead of a monolithic class, its functionality is composed from 12 focused traits:

TraitResponsibility
HasMetadataTitle, author, subject, keywords, language
HasPagesPage management, sizes, margins, page groups
HasTypographyFont loading, sizes, text decorations, RTL, BiDi
HasColorsRGB, CMYK, spot colors, alpha, blend modes
HasTextOutputcell(), multiCell(), text(), write(), writeHtml()
HasDrawingShapes, gradients, patterns, SVG, EPS, images
HasTransformsScale, rotate, translate, skew, mirror
HasLayoutHeaders, footers, columns, booklet
HasNavigationBookmarks, links, TOC, annotations, file attachments
HasInteractiveForm fields, layers, templates, JavaScript
HasSecurityEncryption, digital signatures, tagged PDF, BiDi, linearization
HasOutputoutput(), save(), getPdfData(), streaming

Every public method returns static for fluent chaining:

php
$pdf = Document::create()
    ->setTitle('Invoice')       // HasMetadata
    ->addPage()                 // HasPages
    ->setFont('Helvetica', '', 12) // HasTypography
    ->setFillColor(240, 240, 240)  // HasColors
    ->cell(0, 10, 'Hello')     // HasTextOutput
    ->save('invoice.pdf');      // HasOutput

What's Next

Released under the LGPL-3.0-or-later License.