function SaveAsPdfUaToStream(Stream: TStream; const Options: TPdfUaSaveOptions): Boolean;
SaveAsPdfUaToStream is the streaming counterpart to
SaveAsPdfUa — it produces the same PDF/UA-1 output
pero escribe el resultado en cualquier TStream con capacidad de búsqueda que proporcione la llamada
Useful for HTTP upload pipelines, BLOB columns, in-memory cache
layers, archive containers (ZIP / TAR), or any workflow where the
PDF/UA bytes never need to touch disk.
La lógica de posprocesamiento es idéntica a
SaveAsPdfUa(FileName, Options): the base SaveAs runs
primero; luego una actualización incremental inyecta el flujo de metadatos XMP
(with mandatory dc:title per ISO 14289-1 §7.1 and
the pdfuaid extension schema description), catalog
/MarkInfo and /ViewerPreferences when the
source has none, catalog /Lang when the caller supplied
a BCP 47 tag, and a trailer /ID matriz. Los campos Options que se dejan vacíos se completan automáticamente a partir de los lectores de PDFium (FPDF_GetMetaText, FPDF_GetFileIdentifier,
FPDFCatalog_GetLanguage) so the typical caller only
sets DocumentTitle or Language if needed.
Devuelve True si tiene éxito. El flujo de salida queda en
la posición después del último byte escrito. Devuelve False
si el SaveAs base falló o si no se pudo adjuntar el posprocesamiento (normalmente un origen cifrado).
saRemoveSecurity first.
var
Stream: TMemoryStream;
Opts: TPdfUaSaveOptions;
begin
Stream := TMemoryStream.Create;
try
Opts := TPdfUaSaveOptions.Default;
Opts.DocumentTitle := 'Quarterly Report';
Opts.Language := 'en';
if Pdf1.SaveAsPdfUaToStream(Stream, Opts) then
begin
Stream.Position := 0;
UploadToArchive(Stream);
end;
finally
Stream.Free;
end;
end;