---
title: "Annotations — Vue"
description: "The annotation, shape and insert tools, comments, fonts, stamps, redaction and measurements, and the settings for each."
integration: "Vue"
other_integrations:
  "Vanilla JS": "https://www.embedpdf.com/docs/viewer/vanilla/features/annotations.md"
  "React": "https://www.embedpdf.com/docs/viewer/react/features/annotations.md"
  "Svelte": "https://www.embedpdf.com/docs/viewer/svelte/features/annotations.md"
  "Angular": "https://www.embedpdf.com/docs/viewer/angular/features/annotations.md"
source: "https://www.embedpdf.com/docs/viewer/vue/features/annotations"
---

# Annotations

People mark up a document in three modes: **Annotate** (highlights, notes, ink and text),
**Shapes** and **Insert** (stamps, images, files and signatures). They select an annotation to
move, resize or turn it, change its color, width or kind in the style panel, copy it with
**Duplicate** (`Ctrl`/`Cmd`+`D`), and undo with `Ctrl`/`Cmd`+`Z`. Everything they make is a
standard PDF annotation, so it opens the same in Acrobat and every other PDF app.

## The tools

| Mode     | Tools                                                                                                                                            |
| :------- | :----------------------------------------------------------------------------------------------------------------------------------------------- |
| Annotate | `note`, `link`, `highlight`, `underline`, `strikeout`, `squiggly`, `ink`, `ink-highlight`, `free-text`, `callout`, `insert-text`, `replace-text` |
| Shapes   | `square`, `circle`, `line`, `arrow`, `polygon`, `polyline`                                                                                       |
| Insert   | `stamp`, `image`, `attachment`, `signature`                                                                                                      |

Each tool's button is `tool:<id>`. Change what a tool draws with the annotation plugin's `tools`:

```js
{
  plugins: {
    annotation: {
      tools: [
        { id: 'highlight', defaults: { color: '#fde047', opacity: 0.4 } },
        { id: 'ink', defaults: { color: '#1d4ed8', strokeWidth: 2 } },
      ],
    },
  },
}
```

**`tool-defaults.vue`**

```vue
<script setup lang="ts">
import { PDFViewer, type ViewerConfig } from '@embedpdf/viewer-vue';

const article = 'https://www.embedpdf.com/pdfs/article.pdf';

const config: ViewerConfig = {
  plugins: {
    annotation: {
      tools: [
        { id: 'highlight', defaults: { color: '#fde047', opacity: 0.4 } },
        { id: 'ink', defaults: { color: '#1d4ed8', strokeWidth: 2 } },
      ],
    },
  },
};
</script>

<template>
  <PDFViewer :src="article" v-bind="config" style="height: 100%" />
</template>
```

> **Try it:** in **Annotate**, pick **Highlight** and select a sentence of the blog post, then
> **Draw** on the page: a pale yellow highlight and a thin blue line, the defaults above.

A tool of your own extends a built-in one, and its button goes wherever you put it:

```js
{
  plugins: {
    annotation: {
      tools: [
        {
          id: 'approved',
          extends: 'free-text',
          defaults: { contents: 'Approved', fontColor: '#15803d' },
        },
      ],
    },
  },
  layout: (layout) => layout.add('tool:approved', { to: 'annotate', group: 'text' }),
}
```

Every field a tool takes, and what happens after drawing, is on [Tools &
defaults](https://www.embedpdf.com/docs/headless/vue/annotations/tools.md).

## Comments

Every annotation can carry a comment and replies. The comments panel lists every thread in page
order; picking one goes to its annotation. The user's [`identity`](https://www.embedpdf.com/docs/viewer/vue/features.md#who-the-user-is) is the
author of what they write. In a [read-only](https://www.embedpdf.com/docs/viewer/vue/features/turning-off.md#read-only) viewer, people read every thread but can't
add to it.

> **Review together, live**
>
> With CloudPDF, a team reviews one document together: everyone who has it open sees each other's
> annotations, comments and replies as they're made, and every change is stored on your server.
>
> [Share annotations with CloudPDF](https://www.cloudpdf.com/docs/viewer/vue/features/annotations.md)

## Fonts

The font picker, your own fonts and text in any language are on [Fonts](https://www.embedpdf.com/docs/viewer/vue/features/fonts.md).

## Stamps

The stamps panel has the standard stamps, such as Approved and Confidential, in the user's
language, and every stamp library people make: from an image, from selected annotations, or from
a PDF they import. The libraries they make are kept in the browser across visits.

```js
{
  plugins: {
    stamp: {
      standard: 'https://files.example.com/stamps/{locale}.pdf', // or false for none
      quick: ['standard:Approved', 'standard:Rejected'], // in the Insert toolbar
    },
  },
}
```

| Setting     | What it does                                                                                                  | Default      |
| :---------- | :------------------------------------------------------------------------------------------------------------ | :----------- |
| `standard`  | Where the standard stamps come from: `true` (from your own build), a URL with `{locale}`, or `false` for none | `true`       |
| `libraries` | Your own stamp libraries, each `{ id, url }` or `{ id, data }`: see [Your own stamps](#your-own-stamps)       | none         |
| `quick`     | Stamps to show as buttons in the Insert toolbar, as `library:name`                                            | none         |
| `sidebar`   | The kinds of library the stamps panel lists                                                                   | `['stamps']` |

The stamp plugin's own settings go in the same place: see [Stamps](https://www.embedpdf.com/docs/headless/vue/annotations/stamps.md#settings).

### Your own stamps

Give the viewer stamps of your own, such as a check mark and a cross for ticking off a printed or
scanned form, as a stamp library: a PDF with one page per stamp, the way Acrobat keeps its stamps.
`libraries` loads it under an id you choose, and `quick` puts its stamps in the Insert toolbar as
`<id>:<name>`:

```js
{
  plugins: {
    stamp: {
      libraries: [{ id: 'marks', url: '/marks.pdf' }],
      quick: ['marks:Check', 'marks:Cross'],
    },
  },
}
```

**`own-stamps.vue`**

```vue
<script setup lang="ts">
import { PDFViewer, type ViewerConfig } from '@embedpdf/viewer-vue';

const registration = 'https://www.embedpdf.com/pdfs/registration.pdf';

const config: ViewerConfig = {
  plugins: {
    stamp: {
      libraries: [{ id: 'marks', url: 'https://www.embedpdf.com/pdfs/marks.pdf' }],
      quick: ['marks:Check', 'marks:Cross'],
    },
  },
};
</script>

<template>
  <PDFViewer :src="registration" v-bind="config" style="height: 100%" />
</template>
```

> **Try it:** open **Insert**. Next to **Stamp** are the check mark and the cross. Pick the check
> mark and click the **Vegetarian** box of the printed form, then pick the cross for one of the
> workshops.

A stamp's name is its page's name in the library. A library you export from the stamps panel, or
one of Acrobat's own stamp files, works as it is: see [A library is a
PDF](https://www.embedpdf.com/docs/headless/vue/annotations/stamps.md#a-library-is-a-pdf) to make one.

Your libraries load when the viewer starts, from your app every time. They're never kept in the
browser, unlike the libraries people make, so a new version of the file shows on the next visit,
and the stamps panel lists them with no way to remove them.

### A button of your own

A quick stamp's button shows the stamp itself. For a button with your own icon and label, give it a
[command](https://www.embedpdf.com/docs/viewer/vue/customize/commands.md) that arms the stamp, and put the command in the Insert toolbar:

```js
{
  icons: {
    tick: [
      'M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z',
      'M8.5 12.5l2.5 2.5 5-5',
    ],
  },
  commands: [
    {
      id: 'lanternfield:tick',
      label: 'Tick a box',
      icon: 'tick',
      run: ({ get }) => get('stamp').armAsset('marks:Check'),
      active: ({ get }) =>
        get('stamp').getArmedAsset()?.id === 'marks:Check',
    },
  ],
  layout: (layout) =>
    layout.add('lanternfield:tick', {
      to: 'insert',
      after: 'tool:stamp',
    }),
}
```

**`stamp-command.vue`**

```vue
<script setup lang="ts">
import { PDFViewer, type ViewerConfig } from '@embedpdf/viewer-vue';

const registration = 'https://www.embedpdf.com/pdfs/registration.pdf';

const config: ViewerConfig = {
  plugins: {
    stamp: {
      libraries: [{ id: 'marks', url: 'https://www.embedpdf.com/pdfs/marks.pdf' }],
    },
  },
  icons: {
    tick: ['M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z', 'M8.5 12.5l2.5 2.5 5-5'],
  },
  commands: [
    {
      id: 'lanternfield:tick',
      label: 'Tick a box',
      icon: 'tick',
      run: ({ get }) => get('stamp').armAsset('marks:Check'),
      active: ({ get }) => get('stamp').getArmedAsset()?.id === 'marks:Check',
    },
  ],
  layout: (layout) => layout.add('lanternfield:tick', { to: 'insert', after: 'tool:stamp' }),
};
</script>

<template>
  <PDFViewer :src="registration" v-bind="config" style="height: 100%" />
</template>
```

> **Try it:** open **Insert** and pick **Tick a box**, the circled tick next to **Stamp**. It stays
> pressed while the check mark follows the pointer: click the boxes of the printed form to tick
> them.

## Redaction

Redaction starts off. Turn it on, and the **Redact** mode joins the tabs:

```js
{ features: { redaction: true } }
```

In it, people mark text or areas, check them in the redaction panel, then apply
them all from the panel, or select marks and apply just those from the bar under them. Either way
the viewer asks first, and warns when other annotations under a mark would go too. Applying removes what's under
each mark from the file for good: the text, the images and the drawing, not just what shows. The
color and label of a redacted area are settings:

```js
{
  plugins: {
    redaction: { overlay: { fill: '#111827', text: { color: '#ffffff' } } },
  },
}
```

See [Redaction](https://www.embedpdf.com/docs/headless/vue/annotations/redaction.md#settings).

## Measurements

Measuring starts off. Turn it on, and the **Measure** mode joins the tabs:

```js
{ features: { measurement: true } }
```

In it, people measure distances, perimeters and areas. A drawing's scale comes
from the PDF when it has one; otherwise they set it once with **Calibrate**, by drawing a line of a
known length. A page with no scale uses the default:

```js
{ plugins: { measurement: { defaultScale: 'imperial' } } }
```

See [Measurements](https://www.embedpdf.com/docs/headless/vue/annotations/measurements.md#settings).

## From code

`viewer.get('annotation')` is the annotation plugin: list, create, change and delete annotations,
and listen for changes:

```js
const annotation = viewer.get('annotation');

annotation.onCreated(({ annotation: created }) => save(created));
await annotation.create(0, {
  subtype: 'square',
  rect: { x: 72, y: 72, width: 200, height: 100 },
});
```

Every method is on [Annotations with code](https://www.embedpdf.com/docs/headless/vue/annotations/with-code.md).

## Good to know

### Saved in the PDF

Annotations, comments and stamps are written into the file when it's downloaded, as standard PDF
annotations. To keep them in your own database instead, export and import them with the
annotation plugin: see [Saving annotations](https://www.embedpdf.com/docs/headless/vue/annotations/saving.md).

### Change a mark's kind

The style panel's **Type** turns a selected highlight into an underline, a squiggly line or a
strikethrough, and a square into a circle and back. It stays the same annotation, with its
comment and its replies. A strikethrough that is part of a replacement keeps its kind, and so
does a locked annotation. From code it's `annotation.selection.update({ subtype })`; see
[A style panel](https://www.embedpdf.com/docs/headless/vue/annotations/selecting.md#a-style-panel).

### Duplicate

**Duplicate** in the bar over a selection, or `Ctrl`/`Cmd`+`D`, copies the selected annotations
beside the originals and selects the copies. A stamp keeps its drawing and a group stays a
group. The button shows for annotations that can be moved, so not for a highlight, and it is
greyed out while a locked annotation is selected: its copy would be locked too. From code it's
`annotation.selection.duplicate()`; see
[Duplicate the selection](https://www.embedpdf.com/docs/headless/vue/annotations/selecting.md#duplicate-the-selection).

### Undo

Undo and redo cover everything people do to annotations: drawing, moving, restyling, deleting,
duplicating, and comments. Annotations your code imports are one step too, unless the import
passes `history: false`; see
[An import is one step to undo](https://www.embedpdf.com/docs/headless/vue/annotations/saving.md#an-import-is-one-step-to-undo).
