Form

Visão geral

Form é um tipo em Aspose.PDF FOSS para Go.

Formulário é a visualização AcroForm do documento.

Este tipo fornece 13 métodos para trabalhar com objetos Form em programas Go. Os métodos disponíveis incluem: AddCheckbox, AddComboBox, AddListBox, AddPushButton, AddRadioGroup, AddTextField, Field, Fields, Flatten, HasField, NeedAppearances, RemoveField, e 1 método adicional. Todos os membros do público são acessíveis a qualquer aplicação Go após instalar o pacote Aspose.PDF FOSS for Go.

Métodos

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.
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) → errorWriteFDF 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) → errorWriteJSON 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) → errorWriteXFDF 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.

Ver também

 Português