---
title: "PSPDFKit 2.12 migration guide"
canonical_url: "https://www.nutrient.io/guides/react-native/migration-guides/react-native-2-12-migration-guide/"
md_url: "https://www.nutrient.io/guides/react-native/migration-guides/react-native-2-12-migration-guide.md"
last_updated: "2026-05-25T18:42:17.795Z"
description: "Learn how to migrate to PSPDFKit 2.12 for React Native. Discover new APIs in the PDFDocument object and update your implementation seamlessly."
---

This guide covers migrating to PSPDFKit 2.12 for React Native, after some APIs were moved to the [`PDFDocument`](https://www.nutrient.io/api/react-native/PDFDocument.html) object. These APIs are meant to replace the ones found on the root [`PSPDFKitView`](https://www.nutrient.io/api/react-native/PSPDFKitView.html) interface and offer the same functionality.

If you’re using any of the APIs below, consider migrating to the equivalent APIs now hosted on the [`PDFDocument`](https://www.nutrient.io/api/react-native/PDFDocument.html) object.

### saveCurrentDocument

The API has been renamed to [`save`](https://www.nutrient.io/api/react-native/PDFDocument.html#.save):

```typescript

const result = this.pdfRef?.current?.getDocument().save();

```

### getAllUnsavedAnnotations

The API name remains the same:

```typescript

const result = this.pdfRef?.current?.getDocument().getAllUnsavedAnnotations();

```

### getAnnotations

The old [`getAnnotations`](https://www.nutrient.io/api/react-native/PSPDFKitView.html#.getAnnotations) API has been split into two APIs, now called [`getAnnotations`](https://www.nutrient.io/api/react-native/PDFDocument.html#.getAnnotations) and [`getAnnotationsForPage`](https://www.nutrient.io/api/react-native/PDFDocument.html#.getAnnotationsForPage). [`getAnnotations`](https://www.nutrient.io/api/react-native/PDFDocument.html#.getAnnotations) supports an optional `type` parameter. If no parameter is supplied, all annotation types are returned. [`getAnnotationsForPage`](https://www.nutrient.io/api/react-native/PDFDocument.html#.getAnnotationsForPage) requires a page index, with the option to also pass in a `type` parameter. If no parameter is supplied, all annotation types are returned for the specific page:

```typescript

const result = this.pdfRef?.current?.getDocument().getAnnotations();

```

```typescript

const result = this.pdfRef?.current?.getDocument().getAnnotationsForPage(3, 'pspdfkit/ink');

```

### addAnnotation and addAnnotations

These two APIs have been merged into a single API called [`addAnnotations`](https://www.nutrient.io/api/react-native/PDFDocument.html#.addAnnotations), taking a single `InstantJSON` parameter which consists of a `Map` with an `annotations` key and an array of annotations as a value. The Instant JSON `format` key-value pair is also required as part of the `Map`:

```typescript

const result = this.pdfRef?.current?.getDocument().addAnnotations(instantJSON);

```

### removeAnnotation and removeAnnotations

These two APIs have been merged into a single API called [`removeAnnotations`](https://www.nutrient.io/api/react-native/PDFDocument.html#.removeAnnotations), taking a single `InstantJSON` parameter which consists of an `Array` of annotations to remove:

```typescript

const result = this.pdfRef?.current?.getDocument().removeAnnotations(annotations);

```

### importXFDF

The API name remains the same:

```typescript

const result = this.pdfRef?.current?.getDocument().importXFDF('path/to/XFDF.xfdf');

```

### exportXFDF

The API name remains the same:

```typescript

const result = this.pdfRef?.current?.getDocument().exportXFDF('path/to/XFDF.xfdf');

```

For more information, refer to the [PSPDFKit 2.12 for React Native changelog](https://www.nutrient.io/guides/react-native/changelog.md#2.12).
---

## Related pages

- [React Native 2 13 Migration Guide](/guides/react-native/migration-guides/react-native-2-13-migration-guide.md)
- [React Native 2 16 Migration Guide](/guides/react-native/migration-guides/react-native-2-16-migration-guide.md)
- [React Native 2 2 Migration Guide](/guides/react-native/migration-guides/react-native-2-2-migration-guide.md)
- [React Native 2 9 Migration Guide](/guides/react-native/migration-guides/react-native-2-9-migration-guide.md)
- [React Native 2 3 Migration Guide](/guides/react-native/migration-guides/react-native-2-3-migration-guide.md)
- [React Native 2 8 Migration Guide](/guides/react-native/migration-guides/react-native-2-8-migration-guide.md)
- [React Native 3 Migration Guide](/guides/react-native/migration-guides/react-native-3-migration-guide.md)
- [How to upgrade to the latest React Native version](/guides/react-native/migration-guides/upgrading.md)
- [React Native 4 Migration Guide](/guides/react-native/migration-guides/react-native-4-migration-guide.md)

