HPDFXFAWriteHeadlessPDF

Unit: HPDFXFAHeadless

function HPDFXFAWriteHeadlessPDF(Destination: TStream;
  const XDPBytes, TrueTypeFont: SysUtils.TBytes;
  const Options: TXFAHeadlessPDFOptions;
  Warnings: TStringList): TXFAHeadlessPDFResult;

Destination is caller-owned and must be non-nil; the complete prepared document is written at the current position without truncating any existing content

XDPBytes supplies the template, datasets and optional persisted form state; no prepared input PDF is required

Choice fields preserve /Opt export/display pairs and actual /V and /I selections; boolean fields have actual /AP states and radio members share one parent per native template and data scope

Rectangle, line and elliptical arc draws produce real native paths; inline PNG and JPEG image draws produce native image XObjects with physical aspect and alpha masks, as described in Native graphics and images

TrueTypeFont supplies the actual face embedded into Unicode appearance resources; the caller keeps the array, stream, warning list and cancellation token

Options sets physical page dimensions, editing policy, script execution and resource budgets; Warnings may be nil, in which case warnings are gathered temporarily and the returned warning reference is nil

Graph preparation, XML parsing, appearance building, cancellation and candidate serialisation errors leave Destination unchanged; a destination WriteBuffer error can produce partial writes and is not rolled back for arbitrary streams

Unsupported consumer kinds currently raise EHPDFXFAHeadlessError during preparation; supported kinds and remaining integration work are listed under Automatic XFA creation

Options := TXFAHeadlessPDFOptions.Default;
Options.PageWidth := 300;
Options.PageHeight := 500;
Output := TMemoryStream.Create;
try
  ResultInfo := HPDFXFAWriteHeadlessPDF(Output, SavedXDP, FontBytes,
    Options, nil);
  Output.SaveToFile('native-xfa.pdf');
finally
  Output.Free;
end;

Saving to a stream or file does not launch an external reader nor require a desktop session

Options and result counts give the full public record references