You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+66-23Lines changed: 66 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,7 @@ If this project is useful to you, please consider [supporting development via Gi
27
27
-[PDF Import](#pdf-import)
28
28
-[Remote Resources and fileOptions](#remote-resources-and-fileoptions)
29
29
-[Digital Signatures](#digital-signatures)
30
+
-[PDF/A Archival](#pdfa-archival)
30
31
-[PDF/X Conformance](#pdfx-conformance)
31
32
-[PDF/UA Accessibility](#pdfua-accessibility)
32
33
-[Development](#development)
@@ -121,7 +122,7 @@ The fastest way to evaluate the library is to follow the installation and font s
121
122
- each feature (OCSP, CRL, cert embedding, DSS, VRI) can be enabled independently via `setSignature()` LTV options
122
123
-**PDF annotations**: links, text notes, file attachments, markup, shapes, media, and widgets
123
124
-**JavaScript** embedding
124
-
-**PDF/A** (1/2/3, including a/b/u conformance levels) — see [Factur-X / ZUGFeRD](#other) below
125
+
-**PDF/A** (1/2/3, including a/b/u conformance levels) — see [PDF/A Archival](#pdfa-archival) section and [E001_invoice.php](examples/E001_invoice.php) for a Factur-X / ZUGFeRD example
125
126
-**PDF/X** (generic alias, PDF/X-1a, PDF/X-3, PDF/X-4, PDF/X-5) — print-exchange conformance: per-variant OutputIntent identifiers, GTS_PDFXVersion in Info dict and XMP, PDF version enforcement, CMYK color forcing for restrictive profiles (X-1a, X-3), transparency restrictions, and suppression of encryption and JavaScript
126
127
-**PDF/UA** (generic alias, PDF/UA-1, PDF/UA-2) — accessibility conformance: tagged structure tree (`StructTreeRoot` / `ParentTree`), `MarkInfo /Marked true`, document language (`/Lang`), `DisplayDocTitle true`, `ActualText` for ligatures and special glyphs, figure alt-text tagging, and heading-level clamping to prevent skipped levels; PDF/UA-2 targets PDF 2.0
127
128
@@ -210,6 +211,14 @@ composer update
210
211
composer require ...
211
212
```
212
213
214
+
To also cover `composer dump-autoload` (used in many CI pipelines), add the hook to `post-autoload-dump` as well:
215
+
216
+
```json
217
+
"post-autoload-dump": [
218
+
"@tc-lib-pdf-fonts"
219
+
]
220
+
```
221
+
213
222
If you prefer to generate fonts manually, run the build in the `tc-lib-pdf-font` package:
$html = '<h1>Hello, PDF!</h1><p>Generated with tc-lib-pdf.</p>';
258
267
259
-
$pdf->addHTMLCell($html, 15, 20, 180);
268
+
$pdf->addHTMLCell(
269
+
html: $html,
270
+
posx: 15, // mm from left page edge
271
+
posy: 20, // mm from top page edge
272
+
width: 180, // mm wide (0 = to right margin)
273
+
);
260
274
261
275
$rawpdf = $pdf->getOutPDFString();
262
276
@@ -265,6 +279,8 @@ $pdf->renderPDF($rawpdf);
265
279
266
280
`getOutPDFString()` returns the raw PDF bytes. `renderPDF()` streams those bytes to the browser; if you need file storage or an email attachment, keep the returned string and write or hand it off yourself.
267
281
282
+
> **Note:**`realpath()` returns `false` when the fonts directory does not yet exist. If you see `K_PATH_FONTS` errors on first run, verify that fonts were generated after `composer install` (see [Font Setup](#font-setup)).
283
+
268
284
For more complete examples — including invoices, images, barcodes, HTML tables, dedicated HTML selector/form/table showcases, PDF/X, and PDF/UA — see the [examples](examples) directory.
`tc-lib-pdf` supports PDF/A output for long-term archival workflows (ISO 19005). Pass the mode string as the `mode` argument to the `Tcpdf` constructor:
497
+
498
+
```php
499
+
// PDF/A-1b (default conformance level when suffix is omitted)
500
+
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa1');
501
+
502
+
// Explicit conformance levels
503
+
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa1a'); // PDF/A-1a
504
+
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa1b'); // PDF/A-1b
505
+
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa2a'); // PDF/A-2a
506
+
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa2b'); // PDF/A-2b
507
+
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa2u'); // PDF/A-2u
508
+
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa3a'); // PDF/A-3a
509
+
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa3b'); // PDF/A-3b
510
+
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa3u'); // PDF/A-3u
|`u`| Level U (parts 2/3 only) | required | not required |
518
+
519
+
PDF/A-3 supports embedding arbitrary file attachments (for example XML invoice payloads). This is the basis for **Factur-X / ZUGFeRD** workflows — embed the structured XML in a PDF/A-3 document and register the relationship via XMP metadata:
520
+
521
+
```php
522
+
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa3');
523
+
// ... build document ...
524
+
$pdf->Annotation(/* file attachment annotation pointing to the XML */);
0 commit comments