NativeElixirPdfUtilities.Forms (native_elixir_pdf_utilities v1.1.0)

View Source

Inspects, fills and flattens supported AcroForm fields in existing PDFs.

Values use fully qualified field names. Filling generates self-contained appearances using bundled DejaVu Sans, black text, and automatic sizing. Set appearance: :source to use validated embedded HTML editor fonts and style when available. Flattening removes active interactivity, not historical data or revisions. XFA and changes to signed documents are unsupported.

Summary

Functions

Returns field names, types, values, choices, read-only flags and widget page rectangles.

Fills named fields, shrinking text to fit with bundled DejaVu Sans by default.

Flattens all supported fields, or the names supplied in fields: [...].

Functions

fields(pdf)

@spec fields(binary()) ::
  {:ok, [map()]}
  | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}

Returns field names, types, values, choices, read-only flags and widget page rectangles.

fill(pdf, values, opts \\ [])

@spec fill(binary(), map(), keyword()) ::
  {:ok, binary()}
  | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}

Fills named fields, shrinking text to fit with bundled DejaVu Sans by default.

Set appearance: :source to retain supported HTML fields' original fonts, style and clipping rules instead. Fields without a supported source template still use the default fitted appearance. appearance: :fit selects the default explicitly. flatten: true removes interactivity for the supplied fields after filling.

flatten(pdf, opts \\ [])

@spec flatten(
  binary(),
  keyword()
) ::
  {:ok, binary()}
  | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}

Flattens all supported fields, or the names supplied in fields: [...].

Uses current screen appearances. Hidden and NoView widgets are removed without painting. The Print flag does not affect flattening, so print-only widgets are omitted and screen-only widgets become ordinary page content.