PDFium Component Docs

ImportXFDF-methode

Component: TPdf  ·  Unit: PDFium
Leest een XFDF-document (ISO 19444-1) en past de formulierveldwaarden en annotaties toe op het geladen PDF, maakt annotaties op de overeenkomstige pagina’s en schrijft veldwaarden in hun widgetannotaties

Syntax

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

Description

ImportXFDF parses the XFDF XML document and applies its <fields> and <annots> sections to the currently loaded PDF.

For each <field> element, the qualified (dotted) name is matched against the widget annotations in the document and the value is written into the field's /V entry. For checkbox and radio-button fields, the supplied export value is used to select the matching on-state appearance, so the field is rendered as checked.

Een expliciet leeg <value>-element wist het bijbehorende veld, terwijl een weggelaten waarde het onveranderd laat; diep geneste veldnamen met punten behouden hun volledige hiërarchie

For each annotation element, a new annotation is created on the page indicated by the page attribute (0-based). After creation, the importer fills in Contents, Author (title), Name (NM), Subject, ModificationDate, CreationDate, Icon, and the annotation flags from the corresponding XFDF attributes.

Returns the total number of fields and annotations processed.

Annotatie-import past RGB- en interieurkleuren toe, behoudt expliciet lege tekstvelden, parseert decimale coördinaten onafhankelijk van de proceslocale en herstelt elke markeringsvierhoek uit het attribuut coords

De scanner accepteert elementen en attributen met namespace-prefix, gemengde tekst- en CDATA-knooppunten, XML-entiteitsverwijzingen en witruimte-gevoelige veld- of annotatie-inhoud; ongeldige numerieke Unicode-scalarverwijzingen verwerpen de XFDF-invoer

Een weggelaten annotatie-contents-element laat de inhoud van de nieuwe annotatie afwezig, terwijl een expliciet leeg element een lege waarde schrijft

The rect attribute is mandatory for every annotation: if it is missing, the annotation is skipped rather than created with a zero-size rectangle.

Parsing is performed by a hand-written XML scanner rather than a full XML DOM, so ImportXFDF introduces no XML DOM dependency.

Remarks

Example

// Import field values and annotations from an .xfdf file
Imported := Pdf1.ImportXFDF('C:\Data\form.xfdf');
Pdf1.SaveAs('C:\Data\form_filled.pdf');

See Also

ExportXFDF, CreateAnnotation, Annotation, FormFieldInfo