Standards and Conformance

PDF/A, PDF/X, and PDF/UA modes supported by tc-lib-pdf

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 suffixConformanceUnicode ToUnicodeTagged structure
aLevel Arequiredrequired
bLevel Brequirednot required
uLevel U (parts 2 and 3 only)requirednot 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');
ModeMin PDF versionTransparencyProcess colorsGTS_PDFXVersion
pdfx / pdfx31.3blockedCMYK forcedPDF/X-3:2003
pdfx1a1.3blockedCMYK forcedPDF/X-1a:2003
pdfx41.6allowedunrestrictedPDF/X-4:2010
pdfx51.6allowedunrestrictedPDF/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 StructTreeRoot with a ParentTree
  • Emits MarkInfo << /Marked true >> in the catalog
  • Sets /Lang with en-US as the fallback when no language is provided
  • Forces ViewerPreferences /DisplayDocTitle true
  • Maps HTML heading elements to H1 through H6, clamping levels so no heading level is skipped
  • Tags text runs, links, and figures with structure information
  • Tags <img> elements as Figure and writes their alt attribute as /Alt
  • Emits ActualText entries 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 /BBox Layout attribute. For HTML images it is computed from the image placement; for manually tagged graphics pass it to addTaggedFigureContent():

    $pdf->addTaggedFigureContent($operators, $pid, 'Chart of quarterly revenue', [$x0, $y0, $x1, $y1]);
    
  • Tables: the /BBox is 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/


Previous: /docs/digital-signatures/

Overview: /docs/

Next: /docs/pdf-import/

 

© 2004-2026 – Nicola Asuni - Tecnick.com - All rights reserved.
sponsor - legal notice - privacy