# Labelling an annotation programmatically

**URL:** <https://pdfjs.community/t/labelling-an-annotation-programmatically/3057>\
**Category:** Technical Support\
**Tags:** pdfjs-express\
**Created:** [January 5, 2024, 7:06am UTC](https://pdfjs.community/t/labelling-an-annotation-programmatically/3057 "2024-01-05T07:06:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![neeraj.khosla](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@neeraj.khosla](https://pdfjs.community/u/neeraj.khosla)\
**Post date:** [January 5, 2024, 7:06am UTC](https://pdfjs.community/t/labelling-an-annotation-programmatically/3057/1 "2024-01-05T07:06:31Z")

</div>

**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?**  
all

**Link to document**  
No link

**Code snippet**  
No code snippet

---

<div class="post-metadata">

**Author:** ![tgordon](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@tgordon](https://pdfjs.community/u/tgordon)\
**Post date:** [January 5, 2024, 6:30pm UTC](https://pdfjs.community/t/labelling-an-annotation-programmatically/3057/2 "2024-01-05T18:30:30Z")

</div>

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,  
Tyler

---

<div class="post-metadata">

**Author:** ![neeraj.khosla](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@neeraj.khosla](https://pdfjs.community/u/neeraj.khosla)\
**Post date:** [January 8, 2024, 6:47am UTC](https://pdfjs.community/t/labelling-an-annotation-programmatically/3057/3 "2024-01-08T06:47:13Z")

</div>

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.

 ![annotation with label](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/e/e9003a22aee2b36011dabd9ec0996ca9f64738b4.png)

---

<div class="post-metadata">

**Author:** ![neeraj.khosla](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@neeraj.khosla](https://pdfjs.community/u/neeraj.khosla)\
**Post date:** [January 10, 2024, 9:06am UTC](https://pdfjs.community/t/labelling-an-annotation-programmatically/3057/4 "2024-01-10T09:06:47Z")

</div>

Can someone please help here ? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![tgordon](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@tgordon](https://pdfjs.community/u/tgordon)\
**Post date:** [January 10, 2024, 7:06pm UTC](https://pdfjs.community/t/labelling-an-annotation-programmatically/3057/5 "2024-01-10T19:06:17Z")

</div>

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](https://pdfjs.express/documentation/annotation/custom-annotations)

2. Create a label with a FreeText then group it to the parent annotation [PDFJS Express WebViewer Class: AnnotationManager](https://pdfjs.express/api/Core.AnnotationManager.html#groupAnnotations__anchor)

Best regards,  
Tyler
