PDFiumVCL Docs

SaveAsPdfA method

Deze API-entry behoudt identifiers, signatures, codeblokken en PDF-termen in hun oorspronkelijke vorm.
Component: TPdf  ·  Unit: PDFium
Saves the current document as a PDF/A-1b conformant file by post-processing the base PDF with an incremental update that injects an XMP metadata stream, an sRGB ICC OutputIntent, and an updated document catalog.

Syntax

function SaveAsPdfA(const FileName: string; Conformance: TPdfAConformance = pac1b): Boolean; overload;
function SaveAsPdfA(const FileName: string; const Options: TPdfASaveOptions): Boolean; overload;

Description

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-1b archive (ISO 19005-1, with Cor.1:2007). The post-processing injects four things into the saved stream:

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/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.

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.

Remarks

Example

// 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;

See Also

SaveAsPdfAToStream, ValidatePdfA, PdfAConformance, SaveAs