PDFium Component Docs

ExportXFDF method

Component: TPdf  ·  Unit: PDFium
Serialises all form-field values and annotations into an XFDF (ISO 19444-1) document as UTF-8 XML

Syntax

function ExportXFDF(const FileName: string): Integer; overload;
function ExportXFDF(Stream: TStream): Integer; overload;
function ExportXFDFToStream(Stream: TStream): Integer;

Description

Walks every page and creates <fields> and <annots> sections in the http://ns.adobe.com/xfdf/ namespace

Exports widget fields, hierarchical names, checkbox/radio export values and 18 annotation /Subtype values

Colours use #RRGGBB and coordinate lists use comma-separated numbers

PDFium exposes no XFDF API; the implementation is entirely Pascal in PDFiumPas

Returns the number of UTF-8 bytes written. The Stream overload writes to TStream, the FileName overload creates the file, and ExportXFDFToStream is an alias

Remarks

Example

// Export all fields and annotations to an .xfdf file
BytesWritten := Pdf1.ExportXFDF('C:\Data\form.xfdf');

// Or to a stream
var
  Stream: TFileStream;
begin
  Stream := TFileStream.Create('C:\Data\form.xfdf', fmCreate);
  try
    Pdf1.ExportXFDF(Stream);
  finally
    Stream.Free;
  end;
end;

See Also

ImportXFDF, Annotation, AnnotationCount, FormFieldInfo