Labelling an annotation programmatically

Which product are you using?
PDF.js Express Plus

PDF.js Express Version
Latest version

Detailed description of issue
I want to add a label to the annotation. I also want to give user an ability to change or update the label. Please provide a code sample or directions.

Expected behaviour
A user should be able to see a label on the annotation.

Does your issue happen with every document, or just one?

Link to document
No link

Code snippet
No code snippet

Hello neeraj.khosla,

Can you provide an example image of what you would like to accomplish?

Annotation labels are not PDF spec, so this would have to be a custom implementation.

Best regards,

Something like the attached image. There is an annotation and I have given a label as “Door 1234”. I also want a functionality so that user can edit the label and then raising an event in js to capture and store it in database.

Can someone please help here ? Thanks in advance.

Hello neeeraj.khosla,

This isnt supported by annotations by default, this would require extensive customization. There are some suggestions we have though:

  1. Create a custom annotation that draws the label with the other annotation: Custom Annotations in JavaScript PDF Viewer | PDF.js Express SDK

  2. Create a label with a FreeText then group it to the parent annotation PDFJS Express WebViewer Class: AnnotationManager

Best regards,