Documentation
¶
Index ¶
- func ExportForm(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(id string, fieldType FieldType, format DataFormat) ([]string, bool, bool)
- func FillForm(ctx *model.Context, ...) (bool, []*model.Page, error)
- func ListFormFields(ctx *model.Context) ([]string, error)
- func LockFormFields(ctx *model.Context, fieldIDs []string) (bool, error)
- func RemoveFormFields(ctx *model.Context, fieldIDs []string) (bool, error)
- func ResetFormFields(ctx *model.Context, fieldIDs []string) (bool, error)
- func UnlockFormFields(ctx *model.Context, fieldIDs []string) (bool, error)
- type CSVFieldAttributes
- type CheckBox
- type ComboBox
- type DataFormat
- type DateField
- type Field
- 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 ExportForm ¶
ExportForm 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 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 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 ListFormFields ¶
ListFormFields returns a list of all form fields present in xRefTable.
func LockFormFields ¶
LockFormFields turns all form fields contained in fieldIDs into read-only.
func RemoveFormFields ¶
RemoveFormFields deletes all form fields with given ID from the form represented by xRefTable.
func ResetFormFields ¶
ResetFormFields clears or resets all form fields contained in fieldIDs to its default.
Types ¶
type CSVFieldAttributes ¶
CSVFieldAttributes represent the value(s) and the lock state for a field.
type CheckBox ¶
type CheckBox struct {
Page int `json:"page"`
ID string `json:"id"`
Default bool `json:"default"`
Value bool `json:"value"`
Locked bool `json:"locked"`
}
RadioButtonGroup represents an Acroform checkbox.
type ComboBox ¶
type ComboBox struct {
Page int `json:"page"`
ID string `json:"id"`
Editable bool `json:"editable"`
Options []string `json:"options"`
Default string `json:"default,omitempty"`
Value string `json:"value"`
Locked bool `json:"locked"`
}
ListBox represents an Acroform combobox.
type DateField ¶
type DateField struct {
Page int `json:"page"`
ID string `json:"id"`
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 {
// contains filtered or unexported fields
}
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 {
Page int `json:"page"`
ID string `json:"id"`
Multi bool `json:"multi"`
Options []string `json:"options"`
Defaults []string `json:"defaults,omitempty"`
Values []string `json:"values,omitempty"`
Locked bool `json:"locked"`
}
ListBox represents an Acroform listbox.
type Page ¶
type Page struct {
ImageBoxes []*primitives.ImageBox `json:"image,omitempty"`
}
Page is a container for page imageboxes.