PDFiumVCL Docs

SaveAsPdfXToStream method

Dieser API-Eintrag behält Bezeichner, Signaturen, Codeblöcke und PDF-Begriffe in ihrer Originalform.
Component: TPdf  ·  Unit: PDFium
In-memory variant of SaveAsPdfX — writes PDF/X output into any TStream without staging through disk.

Syntax

function SaveAsPdfXToStream(Stream: TStream; const Options: TPdfXSaveOptions): Boolean;

Description

SaveAsPdfXToStream is the streaming counterpart to SaveAsPdfX — same output bytes, written into any seekable TStream the caller provides. Useful for prepress workflow integration where PDF/X payloads are pushed straight into print submission portals, MIS / job-ticketing systems, BLOB columns, ZIP containers, or HTTP upload pipelines.

The post-processing is identical to SaveAsPdfX: XMP injection with the pdfxid identifier and extension schema description, Document Information Dictionary rewrite with GTS_PDFXVersion / GTS_PDFXConformance / Trapped, catalog update with /Metadata and /OutputIntents references, OutputIntent dictionary with /S /GTS_PDFX and embedded ICC profile, and a trailer /ID array. Options fields left empty are auto-populated from FPDF_GetMetaText / FPDF_GetFileIdentifier.

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

Remarks

Example

var
  Stream: TMemoryStream;
  Opts: TPdfXSaveOptions;
begin
  Stream := TMemoryStream.Create;
  try
    Opts := TPdfXSaveOptions.Default;
    Opts.Conformance := pxc4;
    Opts.Title := 'Spring Catalogue 2026';
    if Pdf1.SaveAsPdfXToStream(Stream, Opts) then
    begin
      Stream.Position := 0;
      SubmitToPrinter(Stream);
    end;
  finally
    Stream.Free;
  end;
end;

See Also

SaveAsPdfX, ValidatePdfX, PdfXConformance, SaveAs