Table of contents
tc-lib-pdf includes dedicated conformance modes for archival, print-exchange, and accessible tagged PDF workflows.
PDF/A Archival
Use the mode constructor argument to select the desired PDF/A profile:
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa1');
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa1a');
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa1b');
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa2a');
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa2b');
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa2u');
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa3a');
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa3b');
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa3u');
The mode argument is declared as string|PdfConformance, so every mode is also available as a case of the \Com\Tecnick\Pdf\PdfConformance enum:
use Com\Tecnick\Pdf\PdfConformance;
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: PdfConformance::Pdfa3b);
| Mode suffix | Conformance | Unicode ToUnicode | Tagged structure |
|---|---|---|---|
a | Level A | required | required |
b | Level B | required | not required |
u | Level U (parts 2 and 3 only) | required | not required |
PDF/A-3 supports embedding arbitrary file attachments such as XML invoice payloads. That is the basis for Factur-X and ZUGFeRD workflows: embed the structured XML in a PDF/A-3 document and register the relationship in the XMP metadata.
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfa3');
// ... build document ...
$pdf->addContentAsEmbeddedFile(
file: 'factur-x.xml',
content: $invoiceXML,
mime: 'text/xml',
afrel: \Com\Tecnick\Pdf\AFRelationship::Alternative,
);
$pdf->setCustomXMP('x:xmpmeta.rdf:RDF.rdf:Description.pdfaExtension:schemas.rdf:Bag', $xmpBag);
The afrel argument accepts the \Com\Tecnick\Pdf\AFRelationship enum (Source, Data, Alternative, Supplement, Unspecified) or the equivalent string.
Runnable example: /examples/E001_invoice/
Output Intent ICC Profile
The bundled sRGB.icc.z output intent profile (stored gzip-compressed) is sourced from the Debian icc-profiles-free package.
PDF/X Print Exchange
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfx');
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfx1a');
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfx3');
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfx4');
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfx5');
| Mode | Min PDF version | Transparency | Process colors | GTS_PDFXVersion |
|---|---|---|---|---|
pdfx / pdfx3 | 1.3 | blocked | CMYK forced | PDF/X-3:2003 |
pdfx1a | 1.3 | blocked | CMYK forced | PDF/X-1a:2003 |
pdfx4 | 1.6 | allowed | unrestricted | PDF/X-4:2010 |
pdfx5 | 1.6 | allowed | unrestricted | PDF/X-5g:2010 |
All PDF/X modes suppress encryption and JavaScript.
Runnable examples: /examples/E010_pdfx/ through /examples/E014_pdfx5/
PDF/UA Accessibility
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfua');
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfua1');
$pdf = new \Com\Tecnick\Pdf\Tcpdf(mode: 'pdfua2');
When a PDF/UA mode is active, the library automatically:
- Writes a
StructTreeRootwith aParentTree - Emits
MarkInfo << /Marked true >>in the catalog - Sets
/Langwithen-USas the fallback when no language is provided - Forces
ViewerPreferences /DisplayDocTitle true - Maps HTML heading elements to
H1throughH6, clamping levels so no heading level is skipped - Tags text runs, links, and figures with structure information
- Tags
<img>elements asFigureand writes theiraltattribute as/Alt - Emits
ActualTextentries for ligatures and special glyphs - Provides Artifact helpers for headers, footers, and other non-semantic content (
beginArtifact(),endArtifact(),addArtifactContent())
You can set the language explicitly:
$pdf->setLanguageArray(['a_meta_language' => 'de-DE']);
Layout Bounding Boxes
Structure elements that need a bounding box now carry one:
Figures: a figure contained on a single page carries a
/BBoxLayout attribute. For HTML images it is computed from the image placement; for manually tagged graphics pass it toaddTaggedFigureContent():$pdf->addTaggedFigureContent($operators, $pid, 'Chart of quarterly revenue', [$x0, $y0, $x1, $y1]);Tables: the
/BBoxis measured at the closing tag and extended to cover top and bottom captions. It is omitted for tables split across a page break, where a single box would not be meaningful.
AcroForm Fields in Tagged Documents
The /DA default appearance font is resolved dynamically instead of requiring a font named helvetica, and /DR font resources are keyed by font buffer index so /DA references always resolve.
Runnable examples: /examples/E015_pdfua/ through /examples/E017_pdfua2/
Related Guides
- Signature workflows for signed archival output: /docs/digital-signatures/
- PDF import behavior under conformance constraints: /docs/pdf-import/
- Development targets for validation pipelines: /docs/development/
Previous: /docs/digital-signatures/
Overview: /docs/
Next: /docs/pdf-import/