Class FieldMapper


  • public final class FieldMapper
    extends java.lang.Object
    Maps the /Root/AcroForm/Fields tree to and from XFDF's flat <fields> list (ISO 19444-1 §6.3).

    XFDF field data is a name/value pair only -- it carries no widget geometry or appearance -- so import here only ever updates a field that already exists in the target PDF's field tree; a name with no match is simply reported back to the caller as not found (see XfdfImporter), never used to fabricate a new field. A field's value still visibly renders correctly afterwards for a checkbox/radio button (its widget(s)' /AS is kept in sync with the new /V here); a text/choice field's value is not visually re-rendered until the next appearance-stream regeneration, same documented limitation as AnnotationMapper.

    Signature fields (/FT /Sig) are skipped entirely in both directions -- a signature's value is a byte-range/certificate structure, not a value XFDF can represent, and touching one risks invalidating it.

    Both directions take a SelectionFilter, checked against each field's /FT code and fully-qualified name -- pass SelectionFilter.NONE for no restriction.

    • Method Detail

      • applyFields

        public static FieldMapper.ApplyResult applyFields​(COSDocument document,
                                                          java.util.List<XfdfField> fields,
                                                          SelectionFilter filter)
        Applies every field in fields that matches an existing terminal field (by fully-qualified name) in document's /AcroForm and passes filter. A field that matches but is excluded by filter counts as neither updated nor not-found -- it does exist, it just wasn't selected for this import.