class HexaPDF::Type::Annotations::Widget

Parent
Included Modules

Widget annotations are used by interactive forms to represent the appearance of fields and to manage user interactions.

See: PDF2.0 s12.5.6.19, HexaPDF::Type::Annotation

Field Definitions

NameType/Allowed ValuesRequiredDefault Value
TypeSymbolfalse:Annot
SubtypeSymboltruenil
RectHexaPDF::Rectangle or Arraytruenil
ContentsStringfalsenil
PHexaPDF::Dictionary or Hashfalsenil
NMStringfalsenil
MHexaPDF::DictionaryFields::PDFDate or String or Time or Date or DateTimefalsenil
FIntegerfalse0
APHexaPDF::Type::Annotation::AppearanceDictionary or Hashfalsenil
ASSymbolfalsenil
BorderHexaPDF::PDFArray or Arrayfalse[0, 0, 1]
CHexaPDF::PDFArray or Arrayfalsenil
StructParentIntegerfalsenil
OCHexaPDF::Dictionary or Hashfalsenil
AFHexaPDF::PDFArray or Arrayfalsenil
caNumericfalse1.0
CANumericfalse1.0
BMSymbolfalsenil
LangStringfalsenil
SubtypeSymboltrue:Widget
HSymbol
One of: :N, :I, :O, :P, :T
falsenil
MKHexaPDF::Type::Annotations::Widget::AppearanceCharacteristics or Hashfalsenil
AHexaPDF::Dictionary or Hashfalsenil
AAHexaPDF::Dictionary or Hashfalsenil
BSHexaPDF::Type::Annotation::Border or Hashfalsenil
ParentHexaPDF::Dictionary or Hashfalsenil

Public Instance Methods

background_color → background_color or nil
background_color(*color) → widget

Returns the current background color as device color object, or nil if no background color is set, when no argument is given. Otherwise sets the background color using the color argument and returns self.

See HexaPDF::Content::ColorSpace.device_color_from_specification for information on the allowed arguments.

form_field()

Returns the AcroForm field object to which this widget annotation belongs.

Since a widget and a field can share the same dictionary object, the returned object is often just the widget re-wrapped in the correct field class.

marker_style → marker_style
marker_style(style: nil, size: nil, color: nil) → widget

Returns a MarkerStyle instance representing the marker style of the widget when no argument is given. Otherwise sets the button marker style of the widget and returns self.

This method returns valid information only for check boxes and radio buttons!

When setting a marker style, arguments that are not provided will use the default: a black auto-sized checkmark (i.e. :check for for check boxes) or circle (:circle for radio buttons). This also means that multiple invocations will reset all prior values.

Note: The marker is called “normal caption” in the PDF 2.0 spec and the /CA entry of the associated appearance characteristics dictionary. The marker size and color are set using the /DA key on the widget (although /DA is not defined for widget, this is how Acrobat does it).

See: PDF2.0 s12.5.6.19 and s12.7.4.3