Skip to contents

Polymorphic setter: the semantics depend on the field's type.

Usage

pdf_form_field_set_value(field, value)

Arguments

field

A pdfium_form_field from pdf_form_fields(). Parent doc must be readwrite.

value

Character scalar OR logical scalar (for checkable types). See type-specific rules above.

Value

Invisibly returns the parent pdfium_doc.

Details

  • Text ("textfield", "xfa_textfield"): value must be a character scalar. Sets /V directly.

  • Checkbox / radio ("checkbox", "radiobutton", "xfa_checkbox"): value may be either a logical scalar or a character scalar. TRUE writes the field's on-state name (inferred from the current /V or /AS, falling back to "Yes"); FALSE writes "Off". A character value is written literally — useful when you already know the export-value string and want to bypass inference.

  • Combobox / listbox ("combobox", "listbox", "xfa_combobox", "xfa_listbox"): value must be a character scalar matching one of the field's options (pdf_form_field_options()).

Any other field type (button / signature / unknown) errors — those don't have a settable value.

Wraps FPDFAnnot_SetStringValue(annot, "V", ...) (plus "AS" for checkboxes and radio buttons). The widget's existing appearance stream (/AP) is left as is: PDFium's public API offers no non-interactive way to regenerate it. Checkable fields switch their /AS appearance state, so their existing on / off appearances follow the value; for text and choice fields the saved file carries the new value alongside the old appearance, which viewers that honor the form's /NeedAppearances flag regenerate.