Form
Opinie generală
Form este un tip în Aspose.PDF FOSS pentru Go.
Formularul este vizualizarea AcroForm a documentului.
Acest tip oferă 13 metode pentru a lucra cu obiecte Form în programele Go. Metodele disponibile includ: AddCheckbox, AddComboBox, AddListBox, AddPushButton, AddRadioGroup, AddTextField, Field, Fields, Flatten, HasField, NeedAppearances, RemoveField, şi 1 metode suplimentare. Toți membrii publicului sunt accesibili oricărei aplicații Go după instalarea pachetului FOSS for Go.
Metode de evaluare
| Signature | Description |
|---|---|
Flatten() → error | Flatten 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() → []Field | Fields returns all leaf form fields as a flat slice. |
Field(name: string) → Field | Field returns the leaf field by FullName, or nil if no such field exists. |
HasField(name: string) → bool | HasField reports whether a leaf field with the given FullName exists. |
NeedAppearances() → bool | NeedAppearances 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) → bool | RemoveField removes the named field (and all its widget annotations) from /AcroForm/Fields and from each affected page’s /Annots. |
ExportFDF() → ([]byte, error) | ExportFDF serialises the form’s field values as an FDF (Forms Data Format) document — a small PDF-syntax file ( %FDF-1.2 … /FDF /Fields [ … ] ) that Acrobat and other readers import. |
WriteFDF(w: io.Writer) → error | WriteFDF writes ExportFDF output to w. |
ImportFDF(data: []byte) → (int, error) | ImportFDF applies field values from an FDF document and returns the number of fields set. |
ReadFDF(r: io.Reader) → (int, error) | ReadFDF reads an FDF document from r and applies it via ImportFDF. |
AddPasswordField(pageNum: int, rect: Rectangle, name: string) → (*PasswordBoxField, error) | AddPasswordField adds a masked text field. |
AddFileSelectField(pageNum: int, rect: Rectangle, name: string) → (*FileSelectBoxField, error) | AddFileSelectField adds a file-select text field. |
AddRichTextField(pageNum: int, rect: Rectangle, name: string) → (*RichTextBoxField, error) | AddRichTextField adds a rich-text field. |
AddNumberField(pageNum: int, rect: Rectangle, name: string, opts: NumberFormatOptions) → (*NumberField, error) | AddNumberField adds a number field formatted per opts. |
AddDateField(pageNum: int, rect: Rectangle, name: string) → (*DateField, error) | AddDateField adds a date field with the given format mask (e.g. |
ExportJSON(opts: ...JSONExportOptions) → ([]byte, error) | ExportJSON serialises the form’s field values to a typed JSON document keyed by each field’s full name: {"name": {"type": "...", "value": ...}} . |
WriteJSON(w: io.Writer, opts: ...JSONExportOptions) → error | WriteJSON writes ExportJSON output to w. |
ImportJSON(data: []byte) → (int, error) | ImportJSON applies field values from a typed JSON document (the shape ExportJSON produces) and returns the number of fields actually set. |
ReadJSON(r: io.Reader) → (int, error) | ReadJSON reads a JSON document from r and applies it via ImportJSON. |
ExportXFDF() → ([]byte, error) | ExportXFDF serialises the form’s field values as an XFDF document. |
WriteXFDF(w: io.Writer) → error | WriteXFDF writes ExportXFDF output to w. |
ImportXFDF(data: []byte) → (int, error) | ImportXFDF applies field values from an XFDF document and returns the number of fields set. |
ReadXFDF(r: io.Reader) → (int, error) | ReadXFDF reads an XFDF document from r and applies it via ImportXFDF. |