# Annotation's labels overlap issue

**URL:** <https://pdfjs.community/t/annotations-labels-overlap-issue/3156>\
**Category:** Technical Support\
**Tags:** pdfjs-express\
**Created:** [February 26, 2024, 3:34pm UTC](https://pdfjs.community/t/annotations-labels-overlap-issue/3156 "2024-02-26T15:34:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![y19mridul](https://avatars.discourse-cdn.com/v4/letter/y/a698b9/32.png) [@y19mridul](https://pdfjs.community/u/y19mridul)\
**Post date:** [February 26, 2024, 3:34pm UTC](https://pdfjs.community/t/annotations-labels-overlap-issue/3156/1 "2024-02-26T15:34:18Z")

</div>

Which product are you using?  
PDF.js Express Plus

PDF.js Express Version  
8.7.4

Detailed description of issue  
I am adding labels to the annotations (these can be manual as well as programmatic). Normally, the behavior is as expected, but when the length of the label is a little longer, the letters/numbers overlap each other. You may see it in the attached link to the screenshot.As you can see, last digit of the label is being overlapped.

> **[Screenshot](https://prnt.sc/_ITPNYULVvLt)**
>
> Captured with Lightshot

![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/4/4448afe3ea6a4974b04b4a84aa58ff257cd33d71.png)

Expected behaviour  
I want the width of the labels to be adjusted dynamically no matter what the size(width) of the annotation is.

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

Code snippet  
const freeTextAnnotation: any = addFreeTextAnnotation(Annotations, annotateData, rotatedX1, rotatedY1, rotation, customData, width);  
freeTextAnnotation.setAutoSizeType(pdfInstance.Core.Annotations.FreeTextAnnotation.AutoSizeTypes.AUTO)  
annotationManager.addAnnotation(freeTextAnnotation);  
annotationManager.drawAnnotationsFromList([lastAnnotation, freeTextAnnotation]);  
annotationManager.groupAnnotations(lastAnnotation, [freeTextAnnotation]);

const addFreeTextAnnotation = (Annotations: any, annotationData: any, x: any, y: any, rotation: any, customData: any, width: any = null) =\> {  
if (!annotationData.page) return;  
const freeText = new Annotations.FreeTextAnnotation();  
freeText.PageNumber = Number(annotationData.page);  
freeText.CustomData = customData  
freeText.NoMove = true;  
freeText.NoResize = true;  
// const textWidth = annotationData.doorId.length \* ((16) / 3);  
switch (rotation) {  
case 0:  
freeText.X = x;  
freeText.Y = y - 10 + freeText.Y  
// freeText.Width = textWidth;//35;  
freeText.Height = 10;  
break;  
case 90:  
freeText.X = x - 10 + freeText.X;  
freeText.Y = y - 10 + freeText.Y;  
// freeText.Width = 10;  
freeText.Height = 10;//35;  
break;  
case 270:  
freeText.X = x + width;  
freeText.Y = y;  
// freeText.Width = 10;  
freeText.Height = 10;//35;  
break;  
default:  
// Handle other rotation angles if necessary  
}

---

<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:** [February 26, 2024, 8:17pm UTC](https://pdfjs.community/t/annotations-labels-overlap-issue/3156/2 "2024-02-26T20:17:24Z")

</div>

Hello y19mridul,

Have you tried our autosizing types? Specifically FIXED\_HEIGHT and FIXED\_WIDTH  
[https://docs.apryse.com/api/web/Core.Annotations.FreeTextAnnotation.html#.AutoSizeTypes\_\_anchor](https://docs.apryse.com/api/web/Core.Annotations.FreeTextAnnotation.html#.AutoSizeTypes__anchor)

Best regards,  
Tyler
