Skip to content

Core Package Overview

Core · LGPL-3.0

The Core package (yeeefang/tcpdf-next) is the foundation of the TCPDF-Next ecosystem. It contains everything needed for PDF 2.0 document generation.

At a Glance

MetricValue
PHP source files148
Modules16
Tests908+
Assertions28,881+
PHPStan level8
Entry pointDocument::create()
LicenseLGPL-3.0-or-later

Entry Point

All documents start with Document::create():

php
use Yeeefang\TcpdfNext\Core\Document;

$pdf = Document::create()
    ->setTitle('My Document')
    ->addPage()
    ->setFont('Helvetica', '', 12)
    ->cell(0, 10, 'Hello World')
    ->save('output.pdf');

The Document class is final and implements PdfDocumentInterface. Its functionality comes from 12 composable traits — see Design Philosophy for details.

Module Map

ModuleNamespaceFilesDocumentation
CoreCore\6Document
ContractsContracts\7API Reference
ValueObjectsValueObjects\5Value Objects
SupportSupport\1API Reference
ContentContent\6Text Output
TypographyTypography\14Typography, Fonts
GraphicsGraphics\19Colors, Graphics, Images
LayoutLayout\6Layout
HtmlHtml\8HTML Rendering
FormForm\5Forms
BarcodeBarcode\12Barcodes
NavigationNavigation\11Navigation
AccessibilityAccessibility\3Tagged PDF
SecuritySecurity\14Encryption, Signatures
WriterWriter\8Output

Capabilities

Text & Typography

Unicode, BiDi (bidirectional text), CJK, Arabic shaping, hyphenation. TTF/OTF/Type1/CFF font subsetting. 14 standard PDF fonts built-in.

Graphics

Shapes (line, rect, circle, ellipse, polygon, star, arrow, curve), gradients (linear, radial, Coons patch mesh, Gouraud triangle mesh), pattern fills, SVG/EPS parsing, image support (PNG, JPEG, WebP, AVIF).

HTML Rendering

Built-in HTML parser supporting div, p, h1-h6, table (colspan/rowspan), lists, inline styling. For full CSS3 (Flexbox, Grid, web fonts), use the Artisan package.

Barcodes

1D: Code 128, EAN-8/13, UPC-A/E, Code 39/93, GS1-128, IMB, and more. 2D: QR Code (ISO 18004), DataMatrix (ISO 16022), PDF417 (ISO 15438).

Security

AES-256 encryption (AESV3 Rev 6) with SASLprep. PAdES B-B digital signatures with visible/invisible appearance. RFC 3161 timestamp client.

Forms

AcroForm fields: text, checkbox, radio button, list box, combo box, button. Form flattening.

Bookmarks, internal/external links, named destinations, annotations, table of contents, file attachments, JavaScript.

Output

Save to file, inline display, download, string buffer. Streaming output for large documents. Linearization for progressive web display. Deterministic mode for reproducible builds.

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