# Annotations

> Annotations in the Document Viewer: notes, text highlights, text, stamps and drawings, the annotation toolbar, custom stamps and the JSON format behind them.

- **Product:** TX Text Control .NET Server
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET Server > Document Viewer > Annotations
- **1535 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/annotations/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/annotations/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/annotations/llms-full.txt

---

Notes, highlights, stamps and drawings are annotations that users add on top of a document in the Document Viewer without changing its content. For review processes, documents delivered with instructions or collecting feedback, you learn which annotation types exist, how users add them and how your application stores and restores them.

### What Annotations Are

Annotations are objects on the pages of a document, similar to the annotations of Adobe Acrobat Reader, but available for every document type the viewer displays. The viewer knows these types:

- **Notes** mark a place on a page and carry comments, like sticky notes on paper.
- **Text highlights** mark a range of text and carry comments on it.
- **Text** adds a line of text anywhere on a page.
- **Stamps** place a predefined label, such as a status, anywhere on a page.
- **Drawings** mark places with freehand lines.
- **Signatures** that users created in the viewer can be placed as annotations as well.

Users add annotations with the annotation toolbar, which the **Toggle the annotation toolbar** button of the main toolbar opens:

![The annotation toolbar of the Document Viewer: select and delete, highlight, comment, text, stamps, signatures, pen, marker, two style menus, erase, clear all, undo and the comments sidebar button](https://docs.textcontrol.com/assets/img/tx-text-control-dotnet-server/annotation-toolbar.2e77c72f.webp)

From left to right, its buttons select and delete annotations, add a text highlight, a note (**Adds a comment to the current location**), text and a stamp, place a signature (**Manage signatures**), draw with a pen or a marker, open two menus for the style of annotations (**Open the annotation style dropdown menu**), erase marker lines, clear all annotations, undo the last action and open the comments sidebar.

Users can add comments to any annotation, and the color, font size and other attributes of annotations can be changed. Typical uses are review processes, in which several users comment on a document before it is approved, and documents that are delivered with notes, for example with instructions on how to fill out a form.

### How Annotations Are Stored

Annotations aren't part of the document: the viewer keeps them separately, and your code exports them as a JSON string, stores it and loads it again with the document. [Import and Export](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/annotations/import-export/#how-annotations-are-stored) describes the storage and the JSON format.

[TXDocumentViewer.annotations](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript-document-viewer/documentviewercontroller/annotations-property/llms-full.txt) returns the [Annotations](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript-document-viewer/annotations/llms-full.txt) object:

| Method | Does |
|---|---|
| [showToolbar](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript-document-viewer/annotations/showtoolbar-method/llms-full.txt) | Shows or hides the annotation toolbar |
| [showSidebar](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript-document-viewer/annotations/showsidebar-method/llms-full.txt) | Shows or hides the sidebar with the comments |
| [export](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript-document-viewer/annotations/export-method/llms-full.txt) | Returns all annotations as a JSON string |
| [load](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript-document-viewer/annotations/load-method/llms-full.txt) | Loads annotations from a JSON string |
| [getStampList](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript-document-viewer/annotations/getstamplist-method/llms-full.txt), [setStampList](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript-document-viewer/annotations/setstamplist-method/llms-full.txt) | Get and set the stamps users can choose |

The viewer raises `annotationsChanged` whenever an annotation has been changed. The [ASP.NET Core](https://docs.textcontrol.com/tx-text-control-dotnet-server/getting-started/document-viewer/aspnet-core/#use-the-javascript-api) tutorial shows the toolbar, loads a note and exports the annotations in a handler of this event.

### Add Custom Stamps

The following script shows the annotation toolbar and adds a "Reviewed" stamp to the stamps of the viewer. Add it to *Views/Home/Index.cshtml* of the ASP.NET Core tutorial:

```javascript
window.addEventListener("documentViewerLoaded", function () {
  TXDocumentViewer.annotations.showToolbar(true);

  // Keep the available stamps and add a stamp of your own at the beginning
  var stamps = TXDocumentViewer.annotations.getStampList();
  stamps.unshift({ text: "Reviewed", color: "rgba(35, 142, 83, .9)", font: "Arial", size: "38", weight: "bold", style: "normal" });
  TXDocumentViewer.annotations.setStampList(stamps);
});
```

A stamp object has a `text`, a `color`, a `font`, a `size`, a `weight` and a `style`. The new stamp is the first entry of the stamp list, which users open with the arrow next to the stamp button; the viewer shows the texts in capital letters:

![The stamp list of the annotation toolbar with the custom stamp REVIEWED in green at the top, followed by the built-in stamps APPROVED, NOT APPROVED, DRAFT and REVISED](https://docs.textcontrol.com/assets/img/tx-text-control-dotnet-server/annotation-stamp-list.6379b197.webp)

The built-in stamps are "approved", "not approved", "draft", "revised", "completed", "confidential", "for public release", "not for public release", "for comment", "void" and "information only", as `getStampList` returns them in version 34.2.0 of the Document Viewer package. The blog article [Adding and Sharing Annotations across Document Types using the Document Viewer in ASP.NET Core C#](https://www.textcontrol.com/blog/2024/04/19/adding-and-sharing-annotations-across-document-types-using-the-document-viewer-in-asp-net-core-c-sharp/) shows annotations and custom stamps in an application.

### Find the Right Page

| If you want to | Read |
|---|---|
| Let reviewers discuss a document with notes and comments, or show the comments a document contains | [Comments](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/annotations/comments/llms-full.txt) |
| Mark ranges of text and read the marked text | [Highlights](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/annotations/highlights/llms-full.txt) |
| Store annotations in your database, load them with the document or merge them into the document | [Import and Export](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/annotations/import-export/llms-full.txt) |

### Pages in This Section

- [Comments](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/annotations/comments/llms-full.txt): notes, comments and the comments sidebar.
- [Highlights](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/annotations/highlights/llms-full.txt): text highlights and how they are stored.
- [Import and Export](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/annotations/import-export/llms-full.txt): the JSON format and storing annotations on the server.

---

## In This Section

- [Comments](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/annotations/comments/llms-full.txt): Comments on annotations in the Document Viewer: notes, several comments per annotation, the comments sidebar, reading comments from JSON and document comments.
- [Highlights](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/annotations/highlights/llms-full.txt): Text highlights in the Document Viewer: marking text ranges with comments, how highlights are stored in the JSON and listing them from JavaScript.
- [Import and Export](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/annotations/import-export/llms-full.txt): Export and import Document Viewer annotations: the JSON format, storing annotations per document through a controller, loading them again and sharing them live.

---

## Nearby

- **Previous:** [User Interface](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/user-interface/llms-full.txt)
- **Next:** [Comments](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/annotations/comments/llms-full.txt)
