---
title: "Embed annotations in PDF in React Native | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/react-native/annotations/save/embed-into-pdf/"
md_url: "https://www.nutrient.io/guides/react-native/annotations/save/embed-into-pdf.md"
last_updated: "2026-05-18T12:22:04.662Z"
description: "Learn how to embed and process annotations in React Native documents using Nutrient's `processAnnotations` function for enhanced document management."
---

# Embed annotations in a PDF file on React Native

Nutrient React Native SDK allows you to create a new document with embedded annotations using the `Nutrient.processAnnotations(annotationChange, annotationType, sourceDocumentPath, processedDocumentPath, password)` function.

## Parameters

`annotationChange` is a string that specifies how Nutrient should include annotations in the resulting document. For embedding annotations while still allowing them to be modified, the annotation change parameter should be set to `embed`. See our [annotation flattening](https://www.nutrient.io/guides/react-native/annotations/flatten.md) guide for a description of the other available processing modes.

`annotationType` is the annotation type parameter that specifies which annotation types Nutrient should process. See the list of all [supported annotation types](https://www.nutrient.io/guides/react-native/annotations/introduction-to-annotations/annotation-types.md). To process all annotations (including forms), you need to set the value for the annotation type parameter to `all` or `null`.

`sourceDocumentPath` is a string that specifies the path of the original document that Nutrient will process.

`password` is an optional string to unlock the source document. Use `null` if not required.

Make sure you save all annotations before processing the document. For more details, refer to our guide showing how to [manually save](https://www.nutrient.io/guides/react-native/save-a-document.md#manual-saving) annotations in a document.

`processedDocumentPath` is a string that specifies the path where the resultant processed file will be stored. The processed document path should be in a writable location (e.g. the [document directory](https://developer.apple.com/documentation/foundation/filemanager/searchpathdirectory/documentdirectory)). You can use a third-party dependency like [`react-native-fs`](https://github.com/itinance/react-native-fs) to ensure that the processed document is stored in a writable location:

```js

const RNFS = require('react-native-fs');
const processedDocumentPath =
	RNFS.DocumentDirectoryPath + '/flattened.pdf';

```

## Use

Here’s how the function call for embedding all ink annotations into a PDF, which will then be saved to `embedded.pdf`, would look:

```js

const sourceDocumentPath =...
const RNFS = require("react-native-fs");
const processedDocumentPath = RNFS.DocumentDirectoryPath + '/embedded.pdf';
Nutrient.processAnnotations('embed', 'ink', sourceDocumentPath, processedDocumentPath, null);

```

The example below shows how to implement a button that embeds all the annotations of the source document from the currently displayed [`NutrientView`](https://www.nutrient.io/api/react-native/NutrientView.html) in a newly processed PDF file:

```js

const sourceDocumentPath =... // The path of the document that's currently displayed in the `NutrientView`.
const RNFS = require("react-native-fs");...
<Button
	onPress={async () => {
		const processedDocumentPath = RNFS.DocumentDirectoryPath + '/flattened.pdf';
		// Delete the processed document if it already exists.
		RNFS.exists(processedDocumentPath).then((exists) => {
				if (exists) {
					RNFS.unlink(processedDocumentPath);
				}
			}).then(() => {
				// First, save all annotations in the current document.
				this.pdfRef?.current?.getDocument().save().then((success) => {
					if (success) {
						// Then, embed all the annotations.
						Nutrient.processAnnotations(
							'embed',
							'all',
							sourceDocumentPath,
							processedDocumentPath,
							null
						).then((success) => {
								if (success) {
									// And finally, present the newly processed document with embedded annotations.
									Nutrient.present(processedDocumentPath, {});
								} else {
									alert('Failed to embed annotations.');
								}
							}).catch((error) => {
								alert(JSON.stringify(error));
							});
					} else {
						alert('Failed to save current document.');
					}
				});
			});
	}}
	title="Embed All Annotations"
/>

```
---

## Related pages

- [Auto save annotations in React Native](/guides/react-native/annotations/save/auto-save.md)
- [Manually save annotations in React Native](/guides/react-native/annotations/save/manual-save.md)
- [Customize annotation saving permissions in React Native](/guides/react-native/annotations/save/saving-permissions.md)

