function SaveAsPdfRToStream(Stream: TStream; const Options: TPdfRSaveOptions): Boolean;
SaveAsPdfRToStream is the streaming counterpart to
SaveAsPdfR — same output bytes, written into any
seekable TStream the caller provides. Useful for document
capture / archival pipelines that take scanner output, attach
PDF/R-1 markers, and push the result to a content store without
touching disk.
The post-processing is identical to SaveAsPdfR: catalog stripped
to the §6.3 white list, Info dictionary stripped to the §6.4.3
white list, XMP stream carrying the four §6.4.4 Table 1 entries,
%PDF-raster-1.0 footer comment, and trailer /ID. Only
the four allowed Info entries (Creator / Producer / CreationDate /
ModDate) auto-populate from FPDF_GetMetaText; Title /
Author / Subject / Keywords are deliberately NOT bridged because
PDF/R prohibits them in the Info dictionary.
Returns True on success.
var
Stream: TMemoryStream;
Opts: TPdfRSaveOptions;
begin
Stream := TMemoryStream.Create;
try
Opts := TPdfRSaveOptions.Default;
Opts.Producer := 'PDFiumVCL scan pipeline';
if Pdf1.SaveAsPdfRToStream(Stream, Opts) then
begin
Stream.Position := 0;
ArchiveScan(Stream);
end;
finally
Stream.Free;
end;
end;