PdfElixide.Form.Field.Choice (pdf_elixide v0.16.0)

Copy Markdown View Source

A choice field (/FT /Ch) — list boxes and combo boxes.

:kind says which of the two it is, read from the /Ff bit :flags decodes as :combo.

The one kind whose value is expected to be a list, since only a list box can hold more than one selection at a time — and only one whose :flags carry :multi_select.

:value is a single selection as a string (whether the PDF spells it as a text string or a name), several selections as a list of strings, or nil. See PdfElixide.Form.Field.value/0 for what a malformed one can put here.

:options is what the field permits, in the order the PDF lists them, or nil when it declares none — each entry a PdfElixide.Form.Field.option/0, so {"DE", "Germany"} is one option and not two. It and :alignment are both inherited from a parent field, as :flags is; the "What a nested field inherits" section of the Forms guide says which keys are and which are not.

See PdfElixide.Form.Field for how fields are named and what every struct carries, and the "What else a field reports" section of the Forms guide for working with the option list.

Summary

Types

Which kind of choice field it is.

t()

Types

kind()

@type kind() :: :combo_box | :list_box

Which kind of choice field it is.

:list_box is the default: this is what a field declaring no /Ff combo bit is.

t()

@type t() :: %PdfElixide.Form.Field.Choice{
  alignment: PdfElixide.Form.Field.alignment(),
  default_value: PdfElixide.Form.Field.value(),
  flags: PdfElixide.Form.Field.Choice.Flags.t(),
  kind: kind(),
  name: String.t(),
  options: [PdfElixide.Form.Field.option()] | nil,
  rect: PdfElixide.Geometry.Rect.t() | nil,
  tooltip: String.t() | nil,
  value: PdfElixide.Form.Field.value()
}