Docs PDFiumVCL

SaveAsPdfEToStream method

Questa voce API conserva identificatori, firme, blocchi di codice e termini PDF nella forma originale.
Component: TPdf  ·  Unit: PDFium
In-memory variant of SaveAsPdfE — writes the PDF/E-1 output into any TStream without staging through disk.

Syntax

function SaveAsPdfEToStream(Stream: TStream; const Options: TPdfESaveOptions): Boolean;

Description

SaveAsPdfEToStream is the streaming counterpart to SaveAsPdfE — it produces the same PDF/E-1 output but writes the result into any seekable TStream the caller provides. Useful for engineering workflow integration where PDF/E payloads are pushed straight into PLM / PDM systems, BLOB columns, archive containers, or HTTP upload pipelines without touching disk.

The post-processing logic is identical to SaveAsPdfE(FileName, Options): the base SaveAs runs first, then an incremental update injects the XMP metadata stream (with pdfe:ISO_PDFEVersion and the extension schema description), rewrites the Document Information Dictionary to add the mandatory /ISO_PDFEVersion (PDF/E-1) entry, updates the catalog to reference the new XMP, and emits a trailer with a fresh /ID array. Options fields left empty are auto-populated from PDFium readers (FPDF_GetMetaText, FPDF_GetFileIdentifier), so a typical caller need only override the Version field for non-default Part / Amd / Corr values.

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 post-processing could not be attached.

Remarks

Example

var
  Stream: TMemoryStream;
  Opts: TPdfESaveOptions;
begin
  Stream := TMemoryStream.Create;
  try
    Opts := TPdfESaveOptions.Default;
    Opts.Producer := 'CAD-Workflow 2026';
    if Pdf1.SaveAsPdfEToStream(Stream, Opts) then
    begin
      Stream.Position := 0;
      PushToPLM(Stream);
    end;
  finally
    Stream.Free;
  end;
end;

See Also

SaveAsPdfE, ValidatePdfE, PdfEConformance, SaveAs