Nutrient 10.4 migration guide

Deprecations removed

A lot of previous deprecations — from mid 2024 and earlier — have been removed from the SDK. All of these should have alternatives that were mentioned in the API documentation in previous versions. If you’re unable to migrate due to a certain method being removed and you’re unable to find a replacement, contact our Support team.

Annotation listeners and the annotation manager

We removed the AnnotationManager interface and moved related methods and annotation listener management to other places, outlined below. Internally, this code was very complex and led to a lot of confusion with multiple ways to do the same thing.

AnnotationManager was essentially a way of managing annotation event listeners. These listeners can also be managed via PdfFragment, and AnnotationProvider.

Listeners

  • com.pspdfkit.ui.special_mode.manager.AnnotationManager.OnAnnotationSelectedListener is now com.pspdfkit.ui.annotations.OnAnnotationSelectedListener.

  • com.pspdfkit.ui.special_mode.manager.AnnotationManager.OnAnnotationDeselectedListener has been merged into com.pspdfkit.ui.annotations.OnAnnotationSelectedListener.

  • com.pspdfkit.ui.special_mode.manager.AnnotationManager.OnAnnotationCreationModeChangeListener is now com.pspdfkit.ui.annotations.OnAnnotationCreationModeChangeListener.

  • com.pspdfkit.ui.special_mode.manager.AnnotationManager.OnAnnotationEditingModeChangeListener is now com.pspdfkit.ui.annotations.OnAnnotationEditingModeChangeListener.

  • com.pspdfkit.ui.special_mode.manager.AnnotationManager.OnAnnotationCreationModeSettingsChangeListener is now com.pspdfkit.ui.annotations.OnAnnotationCreationModeSettingsChangeListener.

  • com.pspdfkit.ui.special_mode.manager.OnAnnotationSelectedListenerAdapter has been removed, as these default implementations are now present in com.pspdfkit.ui.annotations.OnAnnotationSelectedListener.

All of these listeners can still be managed via their respective add/remove methods in PdfFragment.

The original package name for the listeners is still available but is now deprecated. These listeners will be removed in 2026.

OnAnnotationUpdatedListener

AnnotationProvider.OnAnnotationUpdatedListener is in the same place, but registering and unregistering a listener can only be done via PdfFragment, and not via AnnotationProvider.

HTML conversion and WebView

Breaking

  • HtmlToPdfConverter.fromHtmlString() is now one method instead of two. Pass null for the baseUrl argument if you were using the two-argument method before.

  • isFileAccessAllowed — Any methods in the SDK that take a file access Boolean (which is eventually passed to the WebSettings Android SDK method) have been removed due to a violation of security standards. See below for a workaround with HTML-to-PDF conversion.

  • The com.pspdfkit.signatures.Signature.kt constructor is private. From now on, the construction of the signature object is delegated to two static helper methods: (Signature.createInkSignature() and Signature.createStampSignature()).

  • pspdf__electronicSignatureControllerViewStyle is now removed, and its style attributes (pspdf__fontSelectionVisible and pspdf__circleButtonBorderColor) have been moved under pspdf__signatureLayoutStyle.

Deprecations

HTML-to-PDF conversion with file URIs

This version will break HTML-to-PDF conversion using the [URI API][] with files on the file system outside of assets or resources. This is due to security issues with the setAllowFileAccess API. To work around this issue, we’ve added the WebViewSecurityPolicy class, which allows you to edit the WebSettings in your code:

WebViewSecurityPolicy.webViewSettingsCustomizer = object : WebViewSettingsCustomizer {
    override fun customize(settings: WebSettings) {
        settings.allowFileAccess = true
    }
}

Other

  • The pspdf_formHighlightColorLight color ID has been corrected to pspdf__formHighlightColorLight.