function SaveAsPdfAToStream(Stream: TStream; const Options: TPdfASaveOptions): Boolean;
SaveAsPdfAToStream is the streaming counterpart to
SaveAsPdfA — it produces the same PDF/A-1b output,
but writes the result into any seekable TStream the caller provides
instead of going through a temporary file. Useful for HTTP upload
pipelines, BLOB columns, in-memory cache layers, archive containers
(ZIP / TAR), or any workflow where the PDF/A bytes never need to
touch disk.
The post-processing logic is identical to
SaveAsPdfA(FileName, Options) は、まず基本の SaveAs を実行し、その後の増分更新で XMP メタデータストリーム (ISO 19005-1 6.7.3 / Cor.1 Table 1 に従って Document Information Dictionary を XMP 形式へ橋渡しし、6.7.8 で必要な pdfaid 拡張スキーマ記述を埋め込みます)、埋め込み ICC プロファイルを参照する OutputIntent (既定では sRGB、カスタムはOptions.IccProfileData), a catalog update that
links them together, and a trailer /ID array required
by 6.1.3. Options fields left empty are auto-populated from
FPDF_GetMetaText and FPDF_GetFileIdentifier
so the typical caller only sets Conformance.
Returns True on success. The output stream is left at
the position after the last byte written. Returns False
if the base SaveAs failed or if the PDF/A post-processing could not
be attached (typically because the source PDF was encrypted, which
PDF/A forbids).
Write and Seek — a TMemoryStream, TFileStream, or any subclass that honours both works.SaveAsPdfAToStreamは、ストリームの現在位置より後ろにデータがある場合は保持されません。この関数は末尾へシーク済みであることを前提にしませんMemory + Size to the HTTP client directly.saRemoveSecurity first.
var
Stream: TMemoryStream;
Opts: TPdfASaveOptions;
begin
Stream := TMemoryStream.Create;
try
Opts := Default(TPdfASaveOptions);
Opts.Conformance := pac1b;
if Pdf1.SaveAsPdfAToStream(Stream, Opts) then
begin
Stream.Position := 0;
UploadToArchive(Stream);
end;
finally
Stream.Free;
end;
end;