Skip to content

AnnotWidget: support 'de facto' tooltip feature

Most pdf readers implement a tooltip feature by
showing the string content of 'TU' field of a
widget annotation that is not linked to any
form field.

Normally, widget annotations carry a reference to a
form field which are used together to implement the
different form widgets. But, the PDF spec does not
forbid standalone (i.e. not linked to any form field)
widget annotations, and the fact is they're been used
by most pdf readers to show a tooltip when the area
of that AnnotWidget is hovered.

The text used for the tooltip is the one in the 'TU'
field (if present) of the widget annotation.

This 'TU' field is mentioned on the PDF spec to carry
an alternative name for the widget, so we named the
new api on that:

  bool standAlone();
  const GooString *getAlternateName();
  bool setAlternateName(const GooString *altName);

The standAlone() method just tell us if this AnnotWidget
is not linked to any form field, and thus we may proceed
to read the 'TU' field if present.

This commit also adds the corresponding poppler-glib api:

gchar   *poppler_annot_get_alternate_name (PopplerAnnot *annot)
gboolean poppler_annot_set_alternate_name (PopplerAnnot *annot,
                                           const gchar  *name)

Fixes issue #34 
Edited by Nelson Benítez León

Merge request reports