Annotation property to identify its type?

25 views
Skip to first unread message

Marc Egenrieder

unread,
Apr 6, 2018, 1:22:51 PM4/6/18
to PDFTron WebViewer
When I have an Annotation object, the only property to identify what kind of Annotation it is (StickyNote, Arrow, etc.) is found in Annotation.subject.
The problem with this property is, that it only contains the translated type. So if a german user creates an Annotation, any users that views this Annotation only sees the german translation, despite their own language settings being different.
Also when saving the Annotation it would be best if we could store a non translated type.

Is there a way to get the non translated type of an Annotation?

Matt Parizeau

unread,
Apr 6, 2018, 3:23:07 PM4/6/18
to PDFTron WebViewer
You can use annotation.elementName which is the name of the XML element for the annotation in XFDF.

Alternatively you could do instanceof checks on the annotation object to determine what type it is. For example: if (annotation instanceof Annotations.FreeTextAnnotation) {

Matt Parizeau
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
0 new messages