---
title: "Import and export PDF annotations | Nutrient Web SDK with Document Engine"
canonical_url: "https://www.nutrient.io/guides/web/annotations/import-and-export/server-backed/"
md_url: "https://www.nutrient.io/guides/web/annotations/import-and-export/server-backed.md"
last_updated: "2026-05-14T21:57:26.948Z"
description: "Learn to import and export PDF annotations using Nutrient Web SDK with Document Engine. Implement server-backed persistence and collaborative multiuser sync with Instant, while comparing Instant JSON, XFDF, and server-side workflows."
---

# Importing and exporting annotations with Document Engine

When you use [Nutrient Web SDK with Document Engine](https://www.nutrient.io/guides/web/about/operational-modes.md), all of a document’s annotations are imported from Document Engine when you open it. When you create new annotations or update existing annotations through the UI or the API, the changes are exported to Document Engine as well. This process is transparent to you and your users. You can control when the annotations are saved by changing the [auto-save mode](https://www.nutrient.io/guides/web/annotations/annotation-saving-mechanism.md).

Recommendation summary:

- **Instant JSON** — Default format for internal annotation persistence and sync payloads.

- **XFDF** — Use when you need interoperability with external PDF tools.

- **Server-backed (Document Engine with Instant synchronization)** — Recommended for collaborative persistence and synchronization across users/devices.

If you’re deciding between these approaches, start with [how to choose Instant JSON vs. XFDF vs. server-backed sync](https://www.nutrient.io/guides/web/annotations/import-and-export/choose-persistence-strategy.md). For implementation patterns, refer to the [review persistence architecture](https://www.nutrient.io/guides/web/annotations/synchronization/review-persistence-architecture.md).

With [Instant](https://www.nutrient.io/guides/web/instant-synchronization.md), changes made to annotations are automatically synchronized across all connected users, enabling real-time collaboration capabilities in your application.

## Importing and exporting annotations in Instant JSON with Document Engine

You can import and export annotations (including custom rendered annotations) from and to documents opened from Document Engine in the [Instant JSON](https://www.nutrient.io/guides/document-engine/json.md) format.

To import annotations in the Instant JSON format into the currently open document, use the [`NutrientViewer.Instance.applyOperations`](https://www.nutrient.io/api/web/classes/NutrientViewer.Instance.html#applyoperations) API, as demonstrated in the following code snippet. The `instantJson` variable in the code below is an Instant JSON object — for example, the result of parsing a JSON string with [`JSON.parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse):

```js

await instance.applyOperations([
  { type: "applyInstantJson", instantJson: instantJson }
]);

```

To export annotations, use the [`NutrientViewer.Instance.exportInstantJSON`](https://www.nutrient.io/api/web/classes/NutrientViewer.Instance.html#exportinstantjson) method. For example, to print an opened document’s Instant JSON to the console, use the following code snippet:

```js

const instantJSON = await instance.exportInstantJSON();
console.log(instantJSON);

```

Calling `NutrientViewer.Instance.applyOperations` forces a document to reload. To avoid this, import annotations from Instant JSON when you upload a document to Document Engine, or any time during the document lifecycle. For more information, refer to the [importing and exporting Instant JSON with Document Engine](https://www.nutrient.io/guides/document-engine/annotations/import-and-export/instant-json.md) guide.

## Importing and exporting annotations in XFDF with Document Engine

You can also import and export annotations (including custom rendered annotations) from and to documents opened from Document Engine in the [XFDF](https://www.nutrient.io/guides/document-engine/annotations/import-and-export/xfdf.md) format.

To import annotations as XFDF into the currently open document, use the [`NutrientViewer.Instance.applyOperations`](https://www.nutrient.io/api/web/classes/NutrientViewer.Instance.html#applyoperations) API, as demonstrated in the following code snippet. The `xfdf` variable in the code below is an XFDF string:

```js

await instance.applyOperations([
  { type: "applyXfdf", xfdf: xfdf }
]);

```

To export annotations, use the [`NutrientViewer.Instance.exportXFDF`](https://www.nutrient.io/api/web/classes/NutrientViewer.Instance.html#exportxfdf) method. For example, to print the opened document’s XFDF file to the console, use the following code snippet:

```js

const xfdf = await instance.exportXFDF();
console.log(xfdf);

```

Calling `NutrientViewer.Instance.applyOperations` forces a document to reload. To avoid this, you can import annotations from XFDF when you upload a document to Document Engine, or any time during the document lifecycle. For more information, refer to the [Document Engine import and export](https://www.nutrient.io/guides/document-engine/annotations/import-and-export/xfdf.md) guide.
---

## Related pages

- [How to choose Instant JSON vs. XFDF vs. server-backed sync](/guides/web/annotations/import-and-export/choose-persistence-strategy.md)
- [Importing and exporting annotations in a database](/guides/web/annotations/import-and-export/database.md)
- [Importing and exporting annotations with Instant JSON](/guides/web/importing-exporting/instant-json.md)
- [Importing and exporting annotations in XFDF](/guides/web/importing-exporting/xfdf-support.md)

