# How to create TextHighllight same as default TextHighllight Annotation

**URL:** <https://pdfjs.community/t/how-to-create-texthighllight-same-as-default-texthighllight-annotation/1752>\
**Category:** Technical Support\
**Created:** [June 8, 2022, 3:34am UTC](https://pdfjs.community/t/how-to-create-texthighllight-same-as-default-texthighllight-annotation/1752 "2022-06-08T03:34:32Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![arman](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@arman](https://pdfjs.community/u/arman)\
**Post date:** [June 9, 2022, 3:06am UTC](https://pdfjs.community/t/how-to-create-texthighllight-same-as-default-texthighllight-annotation/1752/5 "2022-06-09T03:06:01Z")

</div>

Hey tgordon,

I set the contents using highlight.setContents(getSelectedText()). But you can see that the opacity of default pdfjs highlight annotation is less than the programatically created highlight annotation.

And when I click the edit button of default pdfjs highlight annotation, it show me a comment field and I can not edit the actual content but in self created annotation it give me the access to edit my actual content. Again when I drag the text of default pdfjs highlight annotation from PDF it edit the actual content in the right side bar. But when I drag the text of self created highlight annotation from pdf it do not edit my actual content, it create another text over my content.

[See Video Ref Here](https://www.veed.io/view/e4dc88a9-0827-43aa-bfde-10d91783c3df)

Here is my code snippet.

```javascript
const highlight = new Annotations.TextHighlightAnnotation();
        highlight.Author = annot.Author;
        highlight.Hidden = false;
        highlight.Quads = annot.Quads;
        highlight.StrokeColor = new Annotations.Color(255, 176, 176, 1);
        highlight.PageNumber = annot.getPageNumber();
        highlight.Locked = false;
        highlight.setContents(getSelectedText());
        highlight.setCustomData("trn-custom-data", "Test Data");
        highlight.Subject = 'Highlight';
        annotManager.addAnnotation(highlight, true);
        annotManager.drawAnnotations(1);
    })

```

---

_[View the full topic](https://pdfjs.community/t/how-to-create-texthighllight-same-as-default-texthighllight-annotation/1752)._
