Tổng quan Package Core
Core · LGPL-3.0Package Core (yeeefang/tcpdf-next) là nền tảng của hệ sinh thái TCPDF-Next. Nó chứa mọi thứ cần thiết để tạo tài liệu PDF 2.0.
Tổng quan nhanh
| Chỉ số | Giá trị |
|---|---|
| File mã nguồn PHP | 148 |
| Module | 16 |
| Test | 908+ |
| Assertion | 28,881+ |
| PHPStan level | 10 |
| Điểm vào | Document::create() |
| Giấy phép | LGPL-3.0-or-later |
Điểm vào
Mọi document bắt đầu với 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');Class Document là final và implement PdfDocumentInterface. Chức năng của nó đến từ 12 composable trait — xem Triết lý thiết kế để biết chi tiết.
Bản đồ Module
| Module | Namespace | File | Tài liệu |
|---|---|---|---|
| Core | Core\ | 6 | Document |
| Contracts | Contracts\ | 7 | Tham chiếu API |
| ValueObjects | ValueObjects\ | 5 | Value Object |
| Support | Support\ | 1 | Tham chiếu API |
| Content | Content\ | 6 | Xuất văn bản |
| Typography | Typography\ | 14 | Typography, Font |
| Graphics | Graphics\ | 19 | Màu sắc, Đồ họa, Hình ảnh |
| Layout | Layout\ | 6 | Layout |
| Html | Html\ | 8 | Render HTML |
| Form | Form\ | 5 | Form |
| Barcode | Barcode\ | 12 | Barcode |
| Navigation | Navigation\ | 11 | Navigation |
| Accessibility | Accessibility\ | 3 | Tagged PDF |
| Security | Security\ | 14 | Mã hóa, Chữ ký số |
| Writer | Writer\ | 8 | Output |
Khả năng
Văn bản & Typography
Unicode, BiDi (văn bản hai chiều), CJK, Arabic shaping, hyphenation. TTF/OTF/Type1/CFF font subsetting. 14 font PDF chuẩn có sẵn.
Đồ họa
Hình dạng (line, rect, circle, ellipse, polygon, star, arrow, curve), gradient (linear, radial, Coons patch mesh, Gouraud triangle mesh), pattern fill, phân tích SVG/EPS, hỗ trợ hình ảnh (PNG, JPEG, WebP, AVIF).
Render HTML
Bộ phân tích HTML có sẵn hỗ trợ div, p, h1-h6, table (colspan/rowspan), list, inline styling. Để có CSS3 đầy đủ (Flexbox, Grid, web font), dùng package Artisan.
Barcode
1D: Code 128, EAN-8/13, UPC-A/E, Code 39/93, GS1-128, IMB và nhiều hơn. 2D: QR Code (ISO 18004), DataMatrix (ISO 16022), PDF417 (ISO 15438).
Bảo mật
Mã hóa AES-256 (AESV3 Rev 6) với SASLprep. Chữ ký số PAdES B-B với giao diện hiển thị/ẩn. RFC 3161 timestamp client.
Form
Trường AcroForm: text, checkbox, radio button, list box, combo box, button. Form flattening.
Navigation
Bookmark, link nội bộ/bên ngoài, named destination, annotation, mục lục, file đính kèm, JavaScript.
Output
Lưu ra file, hiển thị inline, tải về, string buffer. Streaming output cho tài liệu lớn. Linearization cho hiển thị web progressive. Chế độ deterministic cho reproducible build.
