function SaveAsPdfA(const FileName: string; Conformance: TPdfAConformance = pac1b): Boolean; overload;
function SaveAsPdfA(const FileName: string; const Options: TPdfASaveOptions): Boolean; overload;
SaveAsPdfA performs the regular SaveAs first, then layers an incremental update on top of the saved bytes that promotes the file to a PDF/A archive (PDF/A-1b by default; ISO 19005-1, with Cor.1:2007). The post-processing injects four things into the saved stream:
pdfaid:part = 1, pdfaid:conformance = B), mirrors every Document Information Dictionary entry into its XMP equivalent (Title → dc:title, Author → dc:creator, Subject → dc:description, Keywords → pdf:Keywords, Creator → xmp:CreatorTool, Producer → pdf:Producer, CreationDate → xmp:CreateDate, ModDate → xmp:ModifyDate) as required by ISO 19005-1 6.7.3, and embeds the pdfaid extension schema description required by 6.7.8 / Cor.1TPdfASaveOptions.IccProfileData; the output intent is then named after that profile: OutputConditionIdentifier and Info take its description tag, or Custom and its colour space when it has none. Set TPdfASaveOptions.OutputConditionIdentifier, OutputCondition and RegistryName to name a registered condition such as FOGRA39 instead/ID array in the trailer (mandatory per ISO 19005-1 6.1.3). When the source PDF already carries a file identifier, the existing 16-byte permanent and changing IDs are reused; otherwise a deterministic 16-byte fallback ID is derived from the source bytesThe output stays byte-identical to the base SaveAs result up to the
end of the original PDF; only the incremental update is appended
Existing readers that don't understand PDF/A still render the file
exactly as the regular SaveAs would. The two overloads differ only
in how the conformance / options are passed in — the
TPdfAConformance form is shorthand for the common case
(pac1b); the TPdfASaveOptions form takes a
record with the full configuration surface, including optional
overrides for Title, Author, Subject, Keywords, Creator, Producer,
CreationDate, ModDate, DocumentId, and InstanceId. Fields left empty
are auto-populated from FPDF_GetMetaText /
FPDF_GetFileIdentifier, so the typical caller does not
need to set any field other than Conformance
The Conformance value selects the target standard and
level. PDF/A-1 (ISO 19005-1) offers pac1b and
pac1a; PDF/A-2 (ISO 19005-2) and PDF/A-3 (ISO 19005-3) add
levels b, u and a as pac2b / pac2u /
pac2a and pac3b / pac3u /
pac3a; PDF/A-4 (ISO 19005-4:2020) offers
pac4base, pac4f and pac4e
The injected pdfaid:part (1, 2, 3 or 4) and
pdfaid:conformance / pdfaid:rev follow the requested value,
while the OutputIntent keeps the GTS_PDFA1 subtype that
ISO 19005-2 retains for every part. Because the post-processor cannot
synthesize logical structure, a Level A request
(pac1a / pac2a / pac3a) is
automatically downgraded to the matching Level B when the source lacks
the tagged-PDF structure that level requires — so the saved file
never makes a false Level A claim. Likewise a pac4f request
on a document without an EmbeddedFiles name tree is written as
plain PDF/A-4 (pac4base)
Returns True on success. Returns False if
the base SaveAs failed, if the incremental update could not be
attached (PDF too short, invalid trailer), or if the ICC profile
data was provided but failed validation
/Encrypt key. (Internally the base save runs with saRemoveSecurity.)ValidatePdfA after the save to inspect the result and surface any remaining issues to operators
// Simple PDF/A-1b output using the bundled sRGB profile
if Pdf1.SaveAsPdfA('C:\Report.pdfa.pdf') then
ShowMessage('Saved PDF/A-1b');
// With a custom ICC profile
var
Opts: TPdfASaveOptions;
begin
Opts := Default(TPdfASaveOptions);
Opts.Conformance := pac1b;
Opts.IccProfileData := TFile.ReadAllBytes('C:\Profiles\Coated.icc');
Pdf1.SaveAsPdfA('C:\Report.cmyk.pdfa.pdf', Opts);
end;
Since v3.256.0, part-4 output writes PDF 2.0 header/catalog markers and pdfaid:rev=2020. The engineering pac4e profile retains its requested conformance without requiring Level A accessibility structure
Mapped Title, Author, Subject, Keywords, Creator, Producer, CreationDate and ModDate values migrate from source Info to XMP, with explicit options taking precedence. Existing mapped XMP values remain available when Info is absent, including subsequent native saves. The active trailer writes /Info null; omitting the entry could inherit an incompatible Info dictionary from an earlier revision
Unmapped Info keys and unsupported metadata representations reject before marker publication rather than silently discarding private values. Marker output does not create required 4f attachments, repair every content rule or certify the result; use ValidatePdfA and independent validation for the intended profile