# Text Markup Annotation

## Content

Text markup annotations are used to mark up text in a document. They can appear as highlights, underlines, strikeouts, or squiggly underlines applied to the page text. The type of markup is specified using the [markupType](https://developer.mescius.com/document-solutions/javascript-pdf-api/api/classes/TextMarkupAnnotation#markuptype) property.
![Text-Markup-Annotation.png](https://cdn.mescius.io/document-site-files/images/706ce9b9-7836-44f3-b62b-7d4408387ae3/Text-Markup-Annotation-20260424.8a7513.png?width=720)
Use the [TextMarkupAnnotation ](https://developer.mescius.com/document-solutions/javascript-pdf-api/api/classes/TextMarkupAnnotation)class to add text markup annotations to a PDF document.

>type=note
> **Note:** The examples on this page use helper functions from the [Snippet Helpers](https://developer.mescius.com/document-solutions/javascript-pdf-api/docs/snippet-helpers) module. These utilities are provided only to simplify the examples and are not part of the DsPdfJS API.

```javascript
const doc = new PdfDocument();
const page = doc.newPage();

let rc = { x: 50, y: 50, width: 200, height: 50 };
const layout = new Layout({
    runs: [{
        text: "This sample demonstrates how you can create Text markup annotation.",
        font: Font.getPdfFont(StandardPdfFont.Times),
        fontSize: 11
    }],
    maxWidth: rc.width,
    maxHeight: rc.height
});
page.context.drawLayout(layout, rc.x, rc.y);
rc = Util.inflate(rc, 15, 24)

//Create an instance of CircleAnnotation class and set its relevant properties
var textMarkupAnnot = new TextMarkupAnnotation();
textMarkupAnnot.markupType = TextMarkupType.Highlight;
textMarkupAnnot.userName = "Jaime Smith";
textMarkupAnnot.contents = "This is a Text markup annotation";
//search the text(e.g employee name) which needs to be redacted
const found = doc.findText({ text: "Text markup", matchCase: true, wholeWord: false });
textMarkupAnnot.area = [].concat(...found.map((fp) => fp.bounds));
textMarkupAnnot.color = "Yellow";
page.annotations.add(textMarkupAnnot);

const docData = doc.savePdf();
Util.saveFile("TextMarkupAnnotation.pdf", docData);
```