class HexaPDF::Type::Annotation::AppearanceDictionary


The appearance dictionary references appearance streams for various use cases.

Each appearance can either be an XObject or a dictionary mapping names to XObjects. The latter is used when the appearance depends on the state of the annotation, e.g. a check box widget that can be checked or unchecked.

See: PDF2.0 s12.5.5

Field Definitions

NameType/Allowed ValuesRequiredDefault Value
NHexaPDF::Dictionary or HexaPDF::Stream or Hashtruenil
RHexaPDF::Dictionary or HexaPDF::Stream or Hashfalsenil
DHexaPDF::Dictionary or HexaPDF::Stream or Hashfalsenil

Public Instance Methods


The down appearance which should be used when the mouse button is pressed or held down inside the active area of the annotation.


The annotation’s normal appearance.


The rollover appearance which should be used when the cursor is moved into the active area of the annotation without pressing a button.

set_appearance(appearance, type: :normal, state_name: nil)

Sets the appearance of the given appearance type, which can either be :normal, :rollover or :down, to appearance.

If the state_name argument is provided, the appearance is stored under the state_name key in a sub-dictionary of the appearance.