---
title: "Customizing annotation permissions in JavaScript PDF viewer | Nutrient"
canonical_url: "https://www.nutrient.io/guides/web/annotations/create-edit-and-remove/permissions/"
md_url: "https://www.nutrient.io/guides/web/annotations/create-edit-and-remove/permissions.md"
last_updated: "2026-05-18T13:37:23.530Z"
description: "Nutrient Web SDK lets you control the actions that can be performed by users on a loaded document."
---

# Customizing annotation permissions

Nutrient Web SDK allows you to control the actions that can be performed by users on a loaded document.

[Try for free](https://www.nutrient.io/sdk/web/getting-started.md)

[Launch demo](https://www.nutrient.io/demo/annotation-permissions)

There are different ways in which you can set the permissions depending on whether or not you’re using Web SDK with Document Engine. They can be categorized as follows:

- [UI-level permissions](#ui-level-permissions)
  - [Client-side permissions](#client-side-permissions)
  - [Server-side permissions](#server-side-permissions)
    - [General permissions](#opening-a-document-in-read-only-mode)
    - [Collaboration permissions](#collaboration-permissions)

- [Document-level permissions](#document-level-permissions)

## UI-level permissions

These permissions are enforced on the viewer and are applicable on all the documents loaded in the viewer. They can be specified on the client side or on server side (if you have a Web SDK with Document Engine setup) using the JSON Web Token (JWT). These permissions aren’t included in the PDF once they’re exported.

### Client-side permissions

These permissions work for both standalone Web SDK and with Document Engine.

#### Opening a document in read-only mode

Set the viewer to read-only mode using [`NutrientViewer.ViewState#readOnly`](https://www.nutrient.io/api/web/classes/NutrientViewer.ViewState.html#readonly):

```js

NutrientViewer.load({...defaultConfiguration,
  initialViewState: new NutrientViewer.ViewState({ readOnly: true })
});

```

When read-only mode is activated, the UI for creating, updating, and deleting annotations will be completely hidden. In addition, the user will no longer be able to select annotations.

However, it’s still possible to add annotations programmatically.

#### Disabling editing specific annotations

The read-only mode discussed in the last section makes all the annotations in a document non-editable. There might be situations in which you want to disable editing specific annotations. This can be achieved by using [`NutrientViewer.Configuration#isEditableAnnotation`](https://www.nutrient.io/api/web/interfaces/Configuration.html#iseditableannotation).

As an example, the following code makes all the ink annotations in a document non-editable:

```js

NutrientViewer.load({...defaultConfiguration,
  isEditableAnnotation: (annotation) =>!(annotation instanceof NutrientViewer.Annotations.InkAnnotation)
});

```

#### Disabling editing based on custom logic

There might be situations where you only want to enable editing of certain annotations for certain users. You can achieve this by specifying the user roles in the annotation’s custom data:

```js

const annotationWithState = annotation.set("customData", {
  forUserRoles: ["manager", "editor"]
});

instance.update(delayedAnnotation);

```

You can make annotations editable based on their roles:

```js

NutrientViewer.load({...defaultConfiguration,
  isEditableAnnotation: (annotation) =>
    annotation.customData.forUserRules.includes(currentUser.role)
});

```

Now an annotation will only be editable when its `forUserRoles` array contains the role of the `currentUser`.

### Server-side permissions

These permissions work for Web SDK with Document Engine. All the methods explained in the client-side permissions section are also applicable here, but if you’re using Document Engine, set these permissions in the JWT, which is more secure and scalable. The permissions set via JWT can’t be overridden on the client side.

#### Opening a document in read-only mode

If you omit the `write` permission from the JWT, the document won’t be editable:

```js

const jwtClaims = {
  document_id: "id",
  permissions: ["read-document"] // "write" is missing here
};

```

You can read about different kinds of document permissions that can be set in the JWT in our [client authentication](https://www.nutrient.io/guides/web/viewer/client-authentication.md) guide.

#### Collaboration Permissions

Collaboration Permissions is a feature that gives you a fine-grained permission system for defining actions allowed by individual users when multiple users are working on the same document. Read our [Collaboration Permissions](https://www.nutrient.io/guides/web/collaboration-permissions/introduction-to-collaboration-permissions.md) guide to learn more about it.

## Document-level permissions

The PDF specification defines a series of flags that can be set on a document to determine what a user can do with a document. These permissions are persisted even after you’ve exported a PDF.

Nutrient honors the permissions set on a document and enables or disables certain platform features based on the permission configuration. If you don’t want this behavior, disable it using [`IGNORE_DOCUMENT_PERMISSIONS`](https://www.nutrient.io/api/web/variables/NutrientViewer.Options.IGNORE_DOCUMENT_PERMISSIONS.html):

```js

NutrientViewer.Options.IGNORE_DOCUMENT_PERMISSIONS = true;

NutrientViewer.load(defaultConfiguration);

```

Read more about these permissions in our [document permissions](https://www.nutrient.io/guides/web/features/document-permissions.md) guide.
---

## Related pages

- [Defining the author of an annotation](/guides/web/annotations/annotation-author-name.md)
- [Add image annotations to PDFs using JavaScript](/guides/web/annotations/create-edit-and-remove/add-image.md)
- [Cut, copy, paste, and duplicate annotations in PDF using JavaScript](/guides/web/annotations/create-edit-and-remove/cut-copy-duplicate.md)
- [Annotation flags](/guides/web/annotations/annotation-flags.md)
- [Edit PDF annotations using JavaScript](/guides/web/annotations/create-edit-and-remove/edit.md)
- [Create PDF annotations using JavaScript](/guides/web/annotations/create-edit-and-remove/create.md)
- [Detect changes in annotations](/guides/web/annotations/detecting-if-annotations-have-changed.md)
- [Select PDF annotations using JavaScript](/guides/web/annotations/create-edit-and-remove/multiple-selection.md)
- [Rich text in PDF annotations using JavaScript](/guides/web/annotations/create-edit-and-remove/rich-text.md)
- [Undo and redo annotations](/guides/web/annotations/create-edit-and-remove/undo-redo.md)
- [Remove PDF annotations using JavaScript](/guides/web/annotations/create-edit-and-remove/remove.md)

