Form

Overview

Form is a type in Aspose.PDF FOSS for Go.

Form is the document’s AcroForm view.

This type provides 13 methods for working with Form objects in Go programs. Available methods include: AddCheckbox, AddComboBox, AddListBox, AddPushButton, AddRadioGroup, AddTextField, Field, Fields, Flatten, HasField, NeedAppearances, RemoveField, and 1 additional methods. All public members are accessible to any Go application after installing the Aspose.PDF FOSS for Go package.

Methods

SignatureDescription
Flatten()errorFlatten bakes every form field’s current appearance into its page’s content stream and then removes all fields, their widgets, and the /AcroForm dict, producing a non-interactive document that renders the same.
Fields()[]FieldFields returns all leaf form fields as a flat slice.
Field(name: string)FieldField returns the leaf field by FullName, or nil if no such field exists.
HasField(name: string)boolHasField reports whether a leaf field with the given FullName exists.
NeedAppearances()boolNeedAppearances reports whether /AcroForm/NeedAppearances is true, which tells viewers to regenerate cached /AP appearance streams when displaying form fields.
SetNeedAppearances(v: bool)SetNeedAppearances toggles /AcroForm/NeedAppearances.
AddTextField(pageNum: int, rect: Rectangle, name: string)(*TextBoxField, error)AddTextField creates a single-line text input on pageNum with the given rectangle and field name, auto-creating /AcroForm and the default Helvetica font resource if needed.
AddCheckbox(pageNum: int, rect: Rectangle, name: string)(*CheckboxField, error)AddCheckbox creates a checkbox widget on pageNum with the given rectangle and field name.
AddComboBox(pageNum: int, rect: Rectangle, name: string, options: []ChoiceOption)(*ComboBoxField, error)AddComboBox creates a single-select dropdown choice field.
AddListBox(pageNum: int, rect: Rectangle, name: string, options: []ChoiceOption)(*ListBoxField, error)AddListBox creates a single-select list field.
AddPushButton(pageNum: int, rect: Rectangle, name: string, caption: string)(*ButtonField, error)AddPushButton creates a non-toggling button.
AddRadioGroup(name: string, items: []RadioItem)(*RadioButtonField, error)AddRadioGroup creates a radio-button parent field plus one widget per item.
RemoveField(name: string)boolRemoveField removes the named field (and all its widget annotations) from /AcroForm/Fields and from each affected page’s /Annots.

See Also