Ensure PDF/A (archival conformance scaffold)
ensure_pdfaAdds PDF/A document-level metadata (ID, sRGB OutputIntent, XMP pdfaid) to an existing PDF for chosen flavour (3b, 4, 4f), preparing for conformance validation without altering content or structure.
Instructions
Put an existing PDF onto the PDF/A "vessel" (the PDF/A counterpart of ensure_tagged). Choose the flavour: "pdfa-3b" (default) / "pdfa-4" / "pdfa-4f". Supplies only the missing document-level requirements: the trailer /ID (ISO 32000-1 14.4), an sRGB OutputIntent (GTS_PDFA1; an ICC profile is generated and embedded), and XMP pdfaid. The -4 flavours additionally set the header to PDF 2.0 and delete the Info dictionary (-4 forbids Info unless the catalog has /PieceInfo — stricter than ISO 32000-2 14.3.3). Content, structure tree and fonts are never touched. Documents with attachments must use "pdfa-4f" — plain "pdfa-4" requires every attachment to be PDF/A itself, so bundling CSV or JSON (the Japanese e-bookkeeping-law pattern) would not conform. IMPORTANT: this is preparation for claiming PDF/A, not a guarantee of conformance. Violations such as unembedded fonts, encryption, JavaScript or LZW are not repaired. Writing pdfaid into XMP is the document claiming "I am PDF/A" — applied to a non-conforming document it produces a PDF that lies about itself (which is why a warning is always returned). Always confirm with pdf-verify-mcp's validate_conformance (flavour: the same value) — the verdict is veraPDF's, and since ISO 19005 clauses cannot be quoted, the strongest statement is "veraPDF judged it so". In the e-bookkeeping-law context, apply it after attaching machine-readable data with attach_file. For signed PDFs, preserveSignatures: true (approval signatures only; certification signatures are refused). However, the -4 flavours combined with preserveSignatures are refused unless the input is already PDF 2.0 (an incremental update cannot rewrite the file header, and rewriting it would break the signatures).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flavour | No | The PDF/A to claim. Default "pdfa-3b". "pdfa-4" (ISO 19005-4) is built on PDF 2.0, so beyond /ID, OutputIntent and XMP pdfaid it **sets the header to 2.0 and drops the Info dictionary** (-4 forbids Info unless PieceInfo is present). **-4 has no conformance level**, so pdfaid:rev is written instead of pdfaid:conformance. **Documents with attachments must use "pdfa-4f"** — plain "pdfa-4" requires every attachment to be PDF/A itself, so bundling JSON or CSV (the Japanese e-bookkeeping-law pattern) would not conform. Combination with preserveSignatures is refused unless the input is already PDF 2.0 (an incremental update cannot rewrite the header, and rewriting it would break the signatures). | |
| inputPath | Yes | Absolute path of the target PDF. | |
| outputPath | No | Destination file path (absolute). When omitted, a base64 string is returned instead. | |
| returnBase64 | No | When true, include a base64 string in the result in addition to saving. | |
| preserveSignatures | No | Edit a signed PDF via an incremental update (appending) without invalidating existing signatures. Default false. The original bytes are untouched, so /ByteRange holds. Changes beyond the certification (DocMDP) permission level are refused. | |
| allowBreakingSignatures | No | When the target is digitally signed (detected via /ByteRange), the default is an error. Set true to proceed, accepting that the signatures become invalid. |