---
title: "Nutrient 5 migration guide"
canonical_url: "https://www.nutrient.io/guides/android/migration-guides/pspdfkit-5-migration-guide/"
md_url: "https://www.nutrient.io/guides/android/migration-guides/pspdfkit-5-migration-guide.md"
last_updated: "2026-06-09T10:25:14.344Z"
description: "Migration guide for Nutrient Android SDK version 5 with breaking changes, API updates, and upgrade instructions."
---

Nutrient Android SDK 5 is a major new release and includes many new features and a few breaking changes.

## Opening documents

The way to open documents has changed slightly. All the `openDocument()` and `openDocumentAsync()` methods that used to be in the [`PdfDocument`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document/-pdf-document/index.html) class moved to their own [`PdfDocumentLoader`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document/-pdf-document-loader/index.html) class.

For example, this:

```java

PdfDocument.openDocument(context, new DocumentSource(new AssetDataProvider("Guide-v4.pdf")));

```

becomes this:

```java

PdfDocumentLoader.openDocument(context, new DocumentSource(new AssetDataProvider("Guide-v4.pdf")));

```

## Bookmark provider

[`BookmarkProvider`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.bookmarks/-bookmark-provider/index.html) was converted to an interface and can no longer be instantiated. Instead, use [`PdfDocument#getBookmarkProvider()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document/-pdf-document/get-bookmark-provider.html) to get an instance.

Furthermore, the `prepareToSave()` method was removed since this is automatically handled by the framework and doesn’t need to be called manually. We also renamed the `isDirty()` method to `hasUnsavedChanges()`.

## Form provider

[`FormProvider`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.forms/-form-provider/index.html) was converted to an interface and can no longer be instantiated. Instead, use [`PdfDocument#getFormProvider()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document/-pdf-document/get-form-provider.html) to get an instance.

Furthermore, we renamed the `isDirty()` method to `hasUnsavedChanges()`.

## Document metadata

[`DocumentPdfMetadata`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.metadata/-document-pdf-metadata/index.html) and [`DocumentXmpMetadata`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.metadata/-document-xmp-metadata/index.html) were converted to interfaces and can no longer be instantiated. Instead, use [`PdfDocument#getPdfMetadata()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document/-pdf-document/get-pdf-metadata.html) and [`PdfDocument#getXmpMetadata()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document/-pdf-document/get-xmp-metadata.html) to retrieve an instance.

Furthermore, the `clearDirty()` method was removed since this is automatically handled by the framework and doesn’t need to be called manually. We also renamed the `isDirty()` method to `hasUnsavedChanges()` since that more accurately describes its function.

## EventBus

With Nutrient 5, we got rid of `EventBus` and all events and commands defined in `Events` and `Commands`:

- `Events.OnZoomScaleFactorChanged` was removed. Use [`DocumentListener#onDocumentZoomed()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.listeners/-document-listener/on-document-zoomed.html) instead.

- `Events.OnPageChanged` was removed. Use [`DocumentListener#onPageChanged()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.listeners/-document-listener/on-page-changed.html) instead.

- `Commands.ClearSelectedAnnotations` was removed. Use [`PdfFragment#clearSelectedAnnotations()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/clear-selected-annotations.html) instead.

- `Commands.SelectAnnotation` was removed. Use [`PdfFragment#setSelectedAnnotation()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/set-selected-annotations.html) instead.

- `Commands.ExecuteAction` was removed. Use [`PdfFragment#executeAction()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/execute-action.html) instead.

- `Commands.ShowPage` was removed. Use [`PdfFragment#setPageIndex()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/set-page-index.html) instead.

- `Commands.ToggleSystemBars` was removed. Use [`PdfActivity#setUserInterfaceVisible()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-ui/set-user-interface-visible.html) instead.

- `Commands.SearchSelectedText` was removed. Use an [`OnSearchSelectedTextListener`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui.special_mode.controller/-text-selection-controller/-on-search-selected-text-listener/index.html) set using [`TextSelectionController#setOnSearchSelectedTextListener`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui.special_mode.controller/-text-selection-controller/set-on-search-selected-text-listener.html) instead.

- `Commands.ShowAnnotationEditor` was removed. Use [`AnnotationCreationController#showAnnotationEditor()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui.special_mode.controller/-annotation-creation-controller/show-annotation-editor.html) or [`AnnotationEditingController#showAnnotationEditor()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui.special_mode.controller/-annotation-editing-controller/show-annotation-editor.html) instead.

- `Commands.ToggleActionBarIconsVisibility` was removed. There is no replacement for this.

## Changes to resources

Starting with Nutrient 5, we [hide resources](https://developer.android.com/studio/projects/android-library#PrivateResources) (strings, IDs, drawables, dimensions, layouts) that are only for internal use. You will receive lint warnings if you try to use private resources, and you should stop using them as soon as possible since they might be removed without warning.

### Changes to theme attributes

Some theme attributes were removed. These include the following:

- `pspdf__mainToolbarTextColor`, `pspdf__mainToolbarTheme`, and `pspdf__mainToolbarPopupTheme`. Use `pspdf__textColor`, `pspdf__toolbarTheme`, and `pspdf__toolbarPopupTheme` in the `pspdf__mainToolbarStyle` instead.

- `pspdf__contextualToolbarBackground` and `pspdf__contextualToolbarSubmenuBackground`. Use `pspdf__backgroundColor` and `pspdf__submenuBackgroundColor` in the `pspdf__ContextualToolbarStyle` instead.

Refer to the [Toolbar Styling](https://www.nutrient.io/guides/android/customizing-the-interface/appearance-styling.md#toolbar-styling) guide for more information and examples of how to style toolbars using these new attributes.

### Changes to default style names

All built-in default styles were renamed to a consistent naming scheme. This means that:

- All styles with the name scheme `pspdf__StyleName` defined in `styles.xml` were renamed to `PSPDFKit.StyleName`.

- All styles with the name scheme `PSPDFKit.Theme.Dark.StyleName` defined in `dark_theme.xml` were renamed to `PSPDFKit.StyleName.Dark`. Some of these styles also had the suffix `Style` in their name, and these suffixes were dropped too.

For example, style `pspdf__ThumbnailBar` was renamed to `PSPDFKit.ThumbnailBar`, and `PSPDFKit.Theme.Dark.ThumbnailBarStyle` was renamed to `PSPDFKit.ThumbnailBar.Dark`.

## Changes to nullability annotations

All methods with parameters annotated with `@NonNull` now throw an `IllegalArgumentException` when they receive `null` as an argument.

## Dropped deprecated fields and methods

Here’s a list of other fields and methods we dropped:

- `PSPDFKit#updateInternalUIContext()`.

- `DocumentDataStore`.

- `com.pspdfkit.annotations.xfdf.XfdfFormatter`. Use `com.pspdfkit.document.formatters.XfdfFormatter` instead.

- `InstantPdfFragment.newInstance(String, String, String, PdfConfiguration)`. Use `newInstance(String, String, PdfConfiguration)` instead.

- `InstantPdfActivityIntentBuilder.fromInstantDocument(Context, String, String, String)`. Use `fromInstantDocument(Context, String, String)` instead.

- `InstantPdfActivity.showInstantDocument(Context, String, String, String, PdfActivityConfiguration)`. Use `showInstantDocument(Context, String, String, PdfActivityConfiguration)` instead.

- `InstantDocumentDescriptor#getAuthenticationToken()`. Use `getJwt()` instead.

- `InstantClient#openDocument(String, String)`. Use `openDocument(String)` instead.

- `InstantClient#openDocumentAsync(String, String)`. Use `openDocumentAsync(String)` instead.

- `InstantClient#getInstantDocumentDescriptor(String)`. Use `getInstantDocumentDescriptorForJwt(String)` instead.

- `InstantPdfDocument#updateAuthenticationToken(String)`. Use `reauthenticateWithJwt(String)` instead.

- `InstantPdfDocument#updateAuthenticationTokenAsync(String)`. Use `reauthenticateWithJwtAsync(String)` instead.

- `InstantPdfDocument#setAutomaticSyncEnabled(boolean)`. Use `setListenToServerChanges(boolean)` and `setDelayForSyncingLocalChanges(long)` instead.

- `AnnotationSyncCoordinator#setAutomaticSyncEnabled(boolean)`. Use `setListenToServerChanges(boolean)` and `setDelayForSyncingLocalChanges(long)` instead.

- `AnnotationManager.OnAnnotationUpdatedListener`. Use `AnnotationProvider.OnAnnotationUpdatedListener` instead.

- `SignatureSignerDialog.show(FragmentManager, PdfDocument, SignatureFormField, Signer, DocumentSigningListener)`. Use `show(FragmentManager, Options, DocumentSigningListener)` instead.

- `SignatureSignerDialog.show(FragmentManager, PdfDocument, SignatureFormField, Signer, BiometricSignatureData, DocumentSigningListener)`. Use `show(FragmentManager, Options, DocumentSigningListener)` instead.

- `ComboBoxFormConfiguration.Builder#setSelectedIndexes(List)`. Use `setSelectedIndex(Integer)` instead.

- `DocumentSharingProcessor`. Use `DocumentSharingProviderProcessor#prepareDocumentForSharing(Context, PdfDocument, PdfProcessorTask, String)` instead.

- `DocumentSharingProvider#deleteTemporaryFile(Context, Uri)`. Use `deleteFile(Context, Uri)` instead.

- `PdfProcessorTask(PdfDocument)`. Use `PdfProcessorTask.fromDocument(PdfDocument)` instead.

- `PdfProcessorTask(NewPage)`. Use `PdfProcessorTask.newPage(NewPage)` instead.

- `Signer#signFormFieldAsync(SignatureFormField, KeyStore.PrivateKeyEntry, OutputStream)`. Use `signFormFieldAsync(SignatureFormField, BiometricSignatureData, OutputStream)` instead.

- `Signer#signFormFieldAsync(SignatureFormField, KeyStore.PrivateKeyEntry, BiometricSignatureData, OutputStream)`. Use `signFormFieldAsync(SignatureFormField, BiometricSignatureData, OutputStream)` instead.

- `Signer#signFormField(SignatureFormField, KeyStore.PrivateKeyEntry, OutputStream)`. Use `signFormField(SignatureFormField, BiometricSignatureData, OutputStream, OnSigningCompleteCallback)` instead.

- `Signer#signFormField(SignatureFormField, KeyStore.PrivateKeyEntry, BiometricSignatureData, OutputStream)`. Use `signFormField(SignatureFormField, BiometricSignatureData, OutputStream, OnSigningCompleteCallback)` instead.

- `MemorySigner#signFormFieldAsync(SignatureFormField, OutputStream)`. Use `signFormFieldAsync(SignatureFormField, BiometricSignatureData, OutputStream)` instead.

- `MemorySigner#signFormField(SignatureFormField, OutputStream)`. Use `signFormField(SignatureFormField, BiometricSignatureData, OutputStream, OnSigningCompleteCallback)` instead.

- `MemorySigner#getSigningKeyPair()`.

- `PdfFragment.PARAM_DOCUMENT_PATHS`, `PdfFragment.PARAM_IMAGE_DOCUMENT_PATH`, `PdfFragment.PARAM_PASSWORDS`, and `PdfFragment.PARAM_CONTENT_SIGNATURES`.

- `PdfFragment#setCustomPdfSource(DataProvider, String)`. Use `setCustomPdfSource(DocumentSource)` instead.

- `PdfFragment#setCustomPdfSources(List, List)`. Use `setCustomPdfSources(List)` instead.

- `PdfFragment#[register/unregister]DrawableProvider()`. Use `PdfFragment#[add/remove]DrawableProvider()` instead.

- `PdfThumbnailGrid#[add/remove]OnDocumentEditingModeChangeListener()`. Use `DocumentEditingManager#[add/remove]OnDocumentEditingModeChangeListener()` instead.

- `PdfThumbnailGrid#[add/remove]OnDocumentEditingPageSelectionChangeListener()`. Use `DocumentEditingManager#[add/remove]OnDocumentEditingPageSelectionChangeListener()` instead.

- `AnnotationProvider#prepareForSave()`. This call is no longer necessary.

- `AnnotationProvider#clearDirty()`. This call is no longer necessary.

- `AnnotationProvider#isDirty()`. Use `hasUnsavedChanges()` instead.

- `PdfConfiguration#annotationReplyFeatureEnabled(boolean)`. Use `annotationReplyFeatures(AnnotationReplyFeatures)` instead.

- `PdfConfiguration#isAnnotationReplyFeatureEnabled()`. Use `getAnnotationReplyFeatures()` instead.

- `PdfActivityConfiguration#annotationReplyFeatureEnabled(boolean)`. Use `annotationReplyFeatures(AnnotationReplyFeatures)` instead.

- `RichMediaExecuteAction#getScreenAnnotationPageIndex()`.

- `RichMediaExecuteAction#getScreenAnnotationObjectNumber()`. Use `getRichMediaAnnotationObjectNumber()` instead.

- `RenditionAction#getScreenAnnotationPageIndex()`.
---

## Related pages

- [10 3 Migration Guide](/guides/android/migration-guides/10-3-migration-guide.md)
- [10 4 Migration Guide](/guides/android/migration-guides/10-4-migration-guide.md)
- [10 5 Migration Guide](/guides/android/migration-guides/10-5-migration-guide.md)
- [2024 9 Migration Guide](/guides/android/migration-guides/2024-9-migration-guide.md)
- [2024 8 Migration Guide](/guides/android/migration-guides/2024-8-migration-guide.md)
- [Pspdfkit 2 1 Migration Guide](/guides/android/migration-guides/pspdfkit-2-1-migration-guide.md)
- [Migrate to electronic signatures](/guides/android/migration-guides/migrating-to-electronic-signatures.md)
- [Nutrient 10 Migration Guide](/guides/android/migration-guides/nutrient-10-migration-guide.md)
- [Pspdfkit 2024 2 Migration Guide](/guides/android/migration-guides/pspdfkit-2024-2-migration-guide.md)
- [Pspdfkit 2024 1 Migration Guide](/guides/android/migration-guides/pspdfkit-2024-1-migration-guide.md)
- [Pspdfkit 2024 3 Migration Guide](/guides/android/migration-guides/pspdfkit-2024-3-migration-guide.md)
- [Pspdfkit 2024 4 Migration Guide](/guides/android/migration-guides/pspdfkit-2024-4-migration-guide.md)
- [Pspdfkit 2024 7 Migration Guide](/guides/android/migration-guides/pspdfkit-2024-7-migration-guide.md)
- [Pspdfkit 2024 6 Migration Guide](/guides/android/migration-guides/pspdfkit-2024-6-migration-guide.md)
- [Pspdfkit 4 4 Migration Guide](/guides/android/migration-guides/pspdfkit-4-4-migration-guide.md)
- [Pspdfkit 3 1 Migration Guide](/guides/android/migration-guides/pspdfkit-3-1-migration-guide.md)
- [Migrate to Nutrient 3.0 with ease](/guides/android/migration-guides/pspdfkit-3-migration-guide.md)
- [Pspdfkit 5 1 Migration Guide](/guides/android/migration-guides/pspdfkit-5-1-migration-guide.md)
- [Pspdfkit 5 2 Migration Guide](/guides/android/migration-guides/pspdfkit-5-2-migration-guide.md)
- [Pspdfkit 5 3 Migration Guide](/guides/android/migration-guides/pspdfkit-5-3-migration-guide.md)
- [Pspdfkit 6 1 Migration Guide](/guides/android/migration-guides/pspdfkit-6-1-migration-guide.md)
- [Pspdfkit 5 5 Migration Guide](/guides/android/migration-guides/pspdfkit-5-5-migration-guide.md)
- [Migration guide for Android SDK 4 features](/guides/android/migration-guides/pspdfkit-4-migration-guide.md)
- [Pspdfkit 6 3 Migration Guide](/guides/android/migration-guides/pspdfkit-6-3-migration-guide.md)
- [Pspdfkit 6 2 Migration Guide](/guides/android/migration-guides/pspdfkit-6-2-migration-guide.md)
- [Pspdfkit 7 Migration Guide](/guides/android/migration-guides/pspdfkit-7-migration-guide.md)
- [Pspdfkit 6 4 Migration Guide](/guides/android/migration-guides/pspdfkit-6-4-migration-guide.md)
- [Pspdfkit 8 7 Migration Guide](/guides/android/migration-guides/pspdfkit-8-7-migration-guide.md)
- [Pspdfkit 6 Migration Guide](/guides/android/migration-guides/pspdfkit-6-migration-guide.md)
- [Pspdfkit 6 6 Migration Guide](/guides/android/migration-guides/pspdfkit-6-6-migration-guide.md)
- [Pspdfkit 8 6 Migration Guide](/guides/android/migration-guides/pspdfkit-8-6-migration-guide.md)
- [Pspdfkit 8 9 Migration Guide](/guides/android/migration-guides/pspdfkit-8-9-migration-guide.md)
- [Pspdfkit 8 Migration Guide](/guides/android/migration-guides/pspdfkit-8-migration-guide.md)
- [Pspdfkit 8 8 Migration Guide](/guides/android/migration-guides/pspdfkit-8-8-migration-guide.md)
- [Upgrading](/guides/android/advanced-integration/upgrading.md)

