Core Package Overview
Core · LGPL-3.0The 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
| Metric | Value |
|---|---|
| PHP source files | 148 |
| Modules | 16 |
| Tests | 908+ |
| Assertions | 28,881+ |
| PHPStan level | 8 |
| Entry point | Document::create() |
| License | LGPL-3.0-or-later |
Entry Point
All documents start with Document::create():
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
| Module | Namespace | Files | Documentation |
|---|---|---|---|
| Core | Core\ | 6 | Document |
| Contracts | Contracts\ | 7 | API Reference |
| ValueObjects | ValueObjects\ | 5 | Value Objects |
| Support | Support\ | 1 | API Reference |
| Content | Content\ | 6 | Text Output |
| Typography | Typography\ | 14 | Typography, Fonts |
| Graphics | Graphics\ | 19 | Colors, Graphics, Images |
| Layout | Layout\ | 6 | Layout |
| Html | Html\ | 8 | HTML Rendering |
| Form | Form\ | 5 | Forms |
| Barcode | Barcode\ | 12 | Barcodes |
| Navigation | Navigation\ | 11 | Navigation |
| Accessibility | Accessibility\ | 3 | Tagged PDF |
| Security | Security\ | 14 | Encryption, Signatures |
| Writer | Writer\ | 8 | Output |
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.
Navigation
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.