Documentation ¶
Index ¶
- func ExportFormJSON(xRefTable *model.XRefTable, source string, w io.Writer) (bool, error)
- func FieldMap(fieldNames, formRecord []string) (map[string]CSVFieldAttributes, map[string]*Page, error)
- func FillDetails(form *Form, fieldMap map[string]CSVFieldAttributes) ...
- func FillForm(ctx *model.Context, ...) (bool, []*model.Page, error)
- func FormFields(ctx *model.Context) ([]Field, *FieldMeta, error)
- func ListFormFields(ctx *model.Context) ([]string, error)
- func LockFormFields(ctx *model.Context, fieldIDsOrNames []string) (bool, error)
- func RemoveFormFields(ctx *model.Context, fieldIDsOrNames []string) (bool, error)
- func ResetFormFields(ctx *model.Context, fieldIDsOrNames []string) (bool, error)
- func UnlockFormFields(ctx *model.Context, fieldIDsOrNames []string) (bool, error)
- type CSVFieldAttributes
- type CheckBox
- type ComboBox
- type DataFormat
- type DateField
- type Field
- type FieldMeta
- type FieldType
- type Form
- type FormGroup
- type Header
- type ListBox
- type Page
- type RadioButtonGroup
- type TextField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExportFormJSON ¶
ExportFormJSON extracts form data originating from source from xRefTable and writes a JSON representation to w.
func FieldMap ¶
func FieldMap(fieldNames, formRecord []string) (map[string]CSVFieldAttributes, map[string]*Page, error)
FieldMap returns structures needed to fill a form via CSV.
func FillDetails ¶
func FillDetails(form *Form, fieldMap map[string]CSVFieldAttributes) func(id, name string, fieldType FieldType, format DataFormat) ([]string, bool, bool)
FillDetails returns a closure that returns new form data provided by CSV or JSON.
func FillForm ¶
func FillForm( ctx *model.Context, fillDetails func(id, name string, fieldType FieldType, format DataFormat) ([]string, bool, bool), imgs map[string]*Page, format DataFormat) (bool, []*model.Page, error)
FillForm populates form fields as provided by fillDetails and also supports virtual image fields.
func FormFields ¶
FormFields returns all form fields present in ctx.
func ListFormFields ¶
ListFormFields returns a list of all form fields present in ctx.
func LockFormFields ¶
LockFormFields turns all form fields contained in fieldIDsOrNames into read-only.
func RemoveFormFields ¶
RemoveFormFields deletes all form fields with given ID or name from the form represented by xRefTable.
func ResetFormFields ¶
ResetFormFields clears or resets all form fields contained in fieldIDsOrNames to its default.
Types ¶
type CSVFieldAttributes ¶
CSVFieldAttributes represent the value(s) and the lock state for a field.
type CheckBox ¶
type CheckBox struct { Pages []int `json:"pages"` ID string `json:"id"` Name string `json:"name,omitempty"` Default bool `json:"default"` Value bool `json:"value"` Locked bool `json:"locked"` }
RadioButtonGroup represents a form checkbox.
type ComboBox ¶
type ComboBox struct { Pages []int `json:"pages"` ID string `json:"id"` Name string `json:"name,omitempty"` Editable bool `json:"editable"` Options []string `json:"options"` Default string `json:"default,omitempty"` Value string `json:"value"` Locked bool `json:"locked"` }
ComboBox represents a form combobox.
type DateField ¶
type DateField struct { Pages []int `json:"pages"` ID string `json:"id"` Name string `json:"name,omitempty"` Format string `json:"format"` Default string `json:"default,omitempty"` Value string `json:"value"` Locked bool `json:"locked"` }
DateField represents an Acroform date field.
type Field ¶
type Field struct { Pages []int Locked bool Typ FieldType ID string Name string Dv string V string Opts string }
Field represents a form field for s particular page number.
type Form ¶
type Form struct { TextFields []*TextField `json:"textfield,omitempty"` DateFields []*DateField `json:"datefield,omitempty"` CheckBoxes []*CheckBox `json:"checkbox,omitempty"` RadioButtonGroups []*RadioButtonGroup `json:"radiobuttongroup,omitempty"` ComboBoxes []*ComboBox `json:"combobox,omitempty"` ListBoxes []*ListBox `json:"listbox,omitempty"` Pages map[string]*Page `json:"pages,omitempty"` }
Form represents a PDF form (aka. Acroform).
type Header ¶
type Header struct { Source string `json:"source"` Version string `json:"version"` Creation string `json:"creation"` ID []string `json:"id,omitempty"` Title string `json:"title,omitempty"` Author string `json:"author,omitempty"` Creator string `json:"creator,omitempty"` Producer string `json:"producer,omitempty"` Subject string `json:"subject,omitempty"` Keywords string `json:"keywords,omitempty"` }
Header represents form meta data.
type ListBox ¶
type ListBox struct { Pages []int `json:"pages"` ID string `json:"id"` Name string `json:"name,omitempty"` Multi bool `json:"multi"` Options []string `json:"options"` Defaults []string `json:"defaults,omitempty"` Values []string `json:"values,omitempty"` Locked bool `json:"locked"` }
ListBox represents a form listbox.
type Page ¶
type Page struct {
ImageBoxes []*primitives.ImageBox `json:"image,omitempty"`
}
Page is a container for page imageboxes.
type RadioButtonGroup ¶
type RadioButtonGroup struct { Pages []int `json:"pages"` ID string `json:"id"` Name string `json:"name,omitempty"` Options []string `json:"options"` Default string `json:"default,omitempty"` Value string `json:"value"` Locked bool `json:"locked"` }
RadioButtonGroup represents a form radio button group.