PDFium Delphi Component Docs

ExportXFDF 메서드

컴포넌트: TPdf  ·  유닛: PDFium
로드된 문서의 모든 페이지에 있는 각 양식 필드 값과 주석을 XFDF(ISO 19444-1) 문서로 직렬화하여 http://ns.adobe.com/xfdf/ 네임스페이스의 UTF-8 XML로 기록합니다

Syntax

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

Description

ExportXFDF walks every page of the loaded document and produces an ISO 19444-1 conformant XFDF document rooted in the http://ns.adobe.com/xfdf/ namespace. The output consists of a <fields> section and an <annots> section, both emitted as UTF-8 XML.

For form fields, the method enumerates the widget annotations of every page, reads each field value, and writes a <field> element. Hierarchical (qualified) field names are split on the dot separator and emitted as nested <field> elements so that the parent/child structure round-trips. Checkboxes and radio buttons export their export value (the appearance-state name that represents the on state) as the field value. Signature fields are listed but their value is never exported.

값 존재 플래그는 명시적으로 비어 있는 필드 값을 생략된 값과 구별하며, 두 수준보다 깊이 중첩된 필드도 포함합니다

For annotations, every non-widget, non-popup annotation on every page is serialized. The exporter recognizes 18 /Subtype values: text, highlight, underline, strikeout, squiggly, line, circle, square, caret, polygon, polyline, stamp, ink, freetext, fileattachment, sound, link, and redact. Each is written as an element under <annots> carrying its page index, bounding rectangle, contents, title (author), name (NM), subject, modification and creation dates, flags, and color.

Encoding conventions follow ISO 19444-1: colors are written as #RRGGBB hex strings; coordinate lists (rectangle, line endpoints, polygon/polyline vertices, ink lists) are comma-separated numbers; and annotation flags are emitted as a comma-separated list of flag names rather than a raw bitmask.

여러 줄 markup annotation의 경우 coords 속성은 첫 번째 줄만이 아니라 문서 순서대로 모든 사변형을 포함합니다

Annotation 내용에도 동일한 존재 의미 체계가 적용되어, 명시적으로 비어 있는 contents 요소는 내보내기 후에도 유지되며 부재 요소가 빈 요소로 바뀌지 않습니다

PDFium itself exposes no XFDF API. ExportXFDF is implemented entirely in Pascal by PDFium Delphi Component on top of its own annotation and form-field data model, querying PDFium only for the per-annotation attribute values.

Returns the number of UTF-8 bytes written. The Stream overload accepts a TStream to write into; the FileName overload accepts a file path and creates/truncates that file. ExportXFDFToStream is an alias for the Stream overload.

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