class HexaPDF:: Type:: Annotations:: Widget
Parent | HexaPDF::Type::Annotation |
---|
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
Name | Type/Allowed Values | Required | Default Value |
---|---|---|---|
Type | Symbol | false | :Annot |
Subtype | Symbol | true | nil |
Rect | HexaPDF::Rectangle or Array | true | nil |
Contents | String | false | nil |
P | HexaPDF::Dictionary or Hash | false | nil |
NM | String | false | nil |
M | HexaPDF::DictionaryFields::PDFDate or String or Time or Date or DateTime | false | nil |
F | Integer | false | 0 |
AP | HexaPDF::Type::Annotation::AppearanceDictionary or Hash | false | nil |
AS | Symbol | false | nil |
Border | HexaPDF::PDFArray or Array | false | [0, 0, 1] |
C | HexaPDF::PDFArray or Array | false | nil |
StructParent | Integer | false | nil |
OC | HexaPDF::Dictionary or Hash | false | nil |
AF | HexaPDF::PDFArray or Array | false | nil |
ca | Numeric | false | 1.0 |
CA | Numeric | false | 1.0 |
BM | Symbol | false | nil |
Lang | String | false | nil |
Subtype | Symbol | true | :Widget |
H | Symbol One of: :N, :I, :O, :P, :T | false | nil |
MK | HexaPDF::Type::Annotations::Widget::AppearanceCharacteristics or Hash | false | nil |
A | HexaPDF::Dictionary or Hash | false | nil |
AA | HexaPDF::Dictionary or Hash | false | nil |
BS | HexaPDF::Type::Annotation::Border or Hash | false | nil |
Parent | HexaPDF::Dictionary or Hash | false | nil |
Constants
- BorderStyle¶
Describes the border of an annotation.
The
color
property is eithernil
if the border is transparent or else a device color object - seeHexaPDF::Content::ColorSpace
.The
style
property can be one of the following:- :solid
-
Solid line.
- :beveled
-
Embossed rectangle seemingly raised above the surface of the page.
- :inset
-
Engraved rectangle receeding into the page.
- :underlined
-
Underlined, i.e. only the bottom border is draw.
Array: Dash array describing how to dash the line.
Public Instance Methods
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.
Returns a BorderStyle
instance representing the border style of the widget when no argument is given. Otherwise sets the border style of the widget and returns self.
When setting a border style, arguments that are not provided will use the default: a border with a solid, black, 1pt wide line. This also means that multiple invocations will reset all prior values.
color
-
The color of the border. See
HexaPDF::Content::ColorSpace.device_color_from_specification
for information on the allowed arguments.If the special value
:transparent
is used when setting the color, a transparent is used. A transparent border will return anil
value when getting the border color. width
-
The width of the border. If set to 0, no border is shown.
style
-
Defines how the border is drawn. can be one of the following:
:solid
-
Draws a solid border.
:beveled
-
Draws a beveled border.
:inset
-
Draws an inset border.
:underlined
-
Draws only the bottom border.
- Array
-
An array specifying a line dash pattern (see
HexaPDF::Content::LineDashPattern
)
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.
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