PaperForge.AcroForm (PaperForge v1.4.1)

Copy Markdown View Source

Creates and edits standard PDF AcroForms.

Supported fields are text, checkbox, push button, radio group, list, combobox, and signature widgets. The module also supports default values, generated appearances, restricted calculation actions, data import/export, and flattening. XFA is intentionally unsupported.

Field appearances can be adapted to the surrounding design with :background_color, :border_color, :border_width, and :border_radius. Checkboxes additionally accept :check_color and :check_width.

Summary

Functions

Adds one AcroForm field to a one-based page index.

Adds a radio-button group and its widget children.

Exports current form values as a map keyed by fully qualified field name.

Flattens field values into page content and removes the interactive form.

Imports values into existing fields and refreshes their basic appearance state.

Rejects XFA forms with a stable error instead of partially editing them.

Returns true when the document catalog contains an XFA entry.

Functions

add_field(document, page, type, name, options \\ [])

Adds one AcroForm field to a one-based page index.

add_radio_group(document, name, choices, options \\ [])

@spec add_radio_group(PaperForge.Document.t(), binary(), [keyword()], keyword()) ::
  PaperForge.Document.t()

Adds a radio-button group and its widget children.

export_data(document)

@spec export_data(PaperForge.Document.t()) :: map()

Exports current form values as a map keyed by fully qualified field name.

flatten(document, options \\ [])

Flattens field values into page content and removes the interactive form.

import_data(document, values)

@spec import_data(PaperForge.Document.t(), map() | keyword()) ::
  PaperForge.Document.t()

Imports values into existing fields and refreshes their basic appearance state.

validate(document)

@spec validate(PaperForge.Document.t()) :: :ok | {:error, :xfa_not_supported}

Rejects XFA forms with a stable error instead of partially editing them.

xfa?(document)

@spec xfa?(PaperForge.Document.t()) :: boolean()

Returns true when the document catalog contains an XFA entry.