TPdfUaSaveOptions.PdfUa2function SaveAsPdfUa(const FileName: string): Boolean; overload;
function SaveAsPdfUa(const FileName: string; const Options: TPdfUaSaveOptions): Boolean; overload;
SaveAsPdfUa performs the regular SaveAs first, then layers an incremental update on top of the saved bytes that promotes the file to a PDF/UA-1 or PDF/UA-2 document. The post-processing injects four classes of markers into the saved stream:
pdfuaid:part = 1) plus the matching pdfaExtension:schemas description, the mandatory dc:title entry (ISO 14289-1 §7.1) and bridged Info-dictionary fields (Author, Subject, Producer, Keywords, CreationDate, ModDate, etc.)/MarkInfo << /Marked true /Suspects false >> when the source catalog has no /MarkInfo entry (§7.1)/ViewerPreferences << /DisplayDocTitle true >> when the source has no /ViewerPreferences entry (§7.1)/Lang (xx) when the source has no /Lang and Options.Language supplies a BCP 47 tag (§7.2). The trailer also gets an /ID array (reused from FPDF_GetFileIdentifier when available, otherwise derived deterministically from the source bytes)The 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/UA still render the file
exactly as the regular SaveAs would. The two overloads differ only
in how the configuration is passed in: the file-name-only form uses
TPdfUaSaveOptions.Default with auto-population from
FPDF_GetMetaText / FPDF_GetFileIdentifier /
FPDFCatalog_GetLanguage, whilst the
TPdfUaSaveOptions form lets the caller override Title,
Author, Subject, Keywords, Creator, Producer, CreationDate, ModDate,
Language, DocumentId, InstanceId and the pdfuaid Part, Revision,
Amd, and Corr identifiers
TPdfUaSaveOptions.PdfUa2 selects Part 2, supplies the
default pdfuaid:rev value 2024, and writes
catalogue /Version /2.0 so an incrementally updated PDF 1.x
source has PDF 2.0 as its effective version
Returns True on success. Returns False if
the base SaveAs failed or if the incremental update could not be
attached (PDF too short, invalid trailer, encrypted source)
SaveAs(..., saRemoveSecurity) first if needed
// Simple PDF/UA-1 output, options auto-populated from the document
if Pdf1.SaveAsPdfUa('C:\Report.pdfua.pdf') then
ShowMessage('Saved PDF/UA-1');
// With explicit options (Title overridden, language explicit)
var
Opts: TPdfUaSaveOptions;
begin
Opts := TPdfUaSaveOptions.Default;
Opts.DocumentTitle := 'Quarterly Report Q3 2026';
Opts.Language := 'en-US';
Pdf1.SaveAsPdfUa('C:\Report.q3.pdfua.pdf', Opts);
// PDF/UA-2 output based on ISO 32000-2
Opts := TPdfUaSaveOptions.PdfUa2;
Opts.DocumentTitle := 'Accessible PDF 2.0 report';
Opts.Language := 'en-US';
Pdf1.SaveAsPdfUa('C:\Report.pdfua2.pdf', Opts);
end;