Документация PDFiumPas

SaveAsPdfA Метод

Эта запись API сохраняет идентификаторы, сигнатуры, блоки кода и термины PDF в исходном виде.
Компонент: TPdf  ·  Модуль: PDFium
Сохраняет текущий document как file, совместимый с PDF/A-1b, путём post-processing base PDF с incremental update, который injects XMP metadata stream, sRGB ICC OutputIntent и updated document catalog

Синтаксис

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

Описание

SaveAsPdfA сначала выполняет обычный SaveAs, а затем накладывает incremental update поверх сохранённых bytes, который переводит file в PDF/A archive (по умолчанию PDF/A-1b; ISO 19005-1, с Cor.1:2007). Post-processing injects четыре вещи в сохранённый 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.

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. The injected pdfaid:part (1, 2 or 3) and pdfaid:conformance (A, B or U) 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.

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.

Примечания

Пример

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

См. также

SaveAsPdfAToStream, ValidatePdfA, PdfAConformance, SaveAs