PSPDFKit 6 Migration Guide | Android
PSPDFKit 6 for Android is a major release and includes many new features and a few breaking changes. This article provides a set of guidelines for migrating from PSPDFKit 5.5 for Android to PSPDFKit 6.0 for Android.
Updated Dependencies
With PSPDFKit 6, we updated various dependencies of PSPDFKit:
-
Build System Dependencies
-
The Android Gradle plugin used to build PSPDFKit was updated to version 3.5.0. In addition, all sample applications now use Android Gradle plugin 3.5.0 as well.
-
Kotlin was updated to version 1.3.50.
-
Merge of PSPDFKit and Instant Libraries
Starting with PSPDFKit 6.0, we no longer provide separate libraries for PSPDFKit and Instant. Instant client code is now part of the PSPDFKit library.
If you are currently using Instant and want to update to 6.0, you need to remove its dependency from your project’s dependencies
block and add the OkHttp
dependency, like so:
dependencies { implementation 'com.pspdfkit:pspdfkit:6.0' - implementation 'com.pspdfkit:pspdfkit-instant:5.5.0' + implementation 'com.squareup.okhttp3:okhttp:3.11.0' }
Notable Changes and Deprecations
Dropped Deprecated Fields and Methods
Here’s a list of other fields and methods we dropped:
-
AnnotationProvider#getAllAnnotationsOfType()
no longer returnsObservable<Annotation>
but now returnsList<Annotation>
. You can useAnnotationProvider#getAllAnnotationsOfTypeAsync()
instead. -
PdfFragment#getAnnotationDefaults()
. UsePdfFragment#getAnnotationConfiguration()
instead. -
PdfFragment#setAnnotationDefaultsProvider()
. UseAnnotationConfigurationRegistry#put()
instead. -
PSPDFKit#setLoggingEnabled()
. To disable logging, remove all loggers viaPdfLog#removeAllLoggers()
. Alternatively, implement a custom logging policy by setting multiple customLogger
s viaPdfLog#setLoggers(Logger...)
. -
AnnotationDefaultsManager
. Replaced byAnnotationConfigurationRegistry
. -
AnnotationDefaultsProvider
. Replaced byAnnotationConfiguration
. -
com.pspdfkit.annotations.defaults.AnnotationProperty
. Usecom.pspdfkit.annotations.configuration.AnnotationProperty
instead. -
AnnotationAggregationStrategyDefaultsProvider
. UseAnnotationAggregationStrategyConfiguration
instead. -
AnnotationDefaultsAlphaProvider
. UseAnnotationAlphaConfiguration
instead. -
AnnotationDefaultsBorderStyleProvider
. UseAnnotationBorderStyleConfiguration
instead. -
AnnotationDefaultsColorProvider
. UseAnnotationColorConfiguration
instead. -
AnnotationDefaultsFillColorProvider
. UseAnnotationFillColorConfiguration
instead. -
AnnotationDefaultsFontProvider
. UseAnnotationFontConfiguration
instead. -
AnnotationDefaultsLineEndTypeProvider
. UseAnnotationLineEndsConfiguration
instead. -
AnnotationDefaultsNoteIconProvider
. UseAnnotationNoteIconConfiguration
instead. -
AnnotationDefaultsOutlineColorProvider
. UseAnnotationOutlineColorConfiguration
instead. -
AnnotationDefaultsOverlayTextProvider
. UseAnnotationOverlayTextConfiguration
instead. -
AnnotationDefaultsPreviewProvider
. UseAnnotationDefaultsProvider
instead. -
AnnotationDefaultsRepeatOverlayTextProvider
. UseAnnotationOverlayTextConfiguration
instead. -
AnnotationDefaultsTextSizeProvider
. UseAnnotationTextSizeConfiguration
instead. -
AnnotationDefaultsThicknessProvider
. UseAnnotationThicknessConfiguration
instead. -
AnnotationDefaultsStampProvider
. UseStampAnnotationConfiguration.Builder
instead. -
EraserDefaultsProvider
. UseEraserToolConfiguration.Builder
instead. -
FileAnnotationDefaultsProvider
. UseFileAnnotationConfiguration.Builder
instead. -
FreeTextAnnotationDefaultsProvider
. UseFreeTextAnnotationConfiguration.Builder
instead. -
InkAnnotationDefaultsProvider
. UseInkAnnotationConfiguration.Builder
instead. -
LineAnnotationDefaultsProvider
. UseLineAnnotationConfiguration.Builder
instead. -
MarkupAnnotationDefaultsProvider
. UseMarkupAnnotationConfiguration.Builder
instead. -
NoteAnnotationDefaultsProvider
. UseNoteAnnotationConfiguration.Builder
instead. -
RedactionAnnotationDefaultsProvider
. UseRedactionAnnotationConfiguration.Builder
instead. -
ShapeAnnotationDefaultsProvider
. UseShapeAnnotationConfiguration.Builder
instead. -
StampAnnotationDefaultsProvider
. UseStampAnnotationConfiguration.Builder
instead. -
DEFAULT_STAMP_ANNOTATION_PDF_WIDTH
,DEFAULT_STAMP_ANNOTATION_PDF_HEIGHT
, andDEFAULT_STAMP_ANNOTATION_ASPECT_RATIO
have been moved fromStampAnnotationDefaultsProvider
toStampPickerItem
. -
AnnotationPreferencesManager#getBorderStyle()
. UseBorderStylePreset#getBorderStyle()
on the border style preset returned viaAnnotationPreferencesManager#getBorderStylePreset()
. -
AnnotationPreferencesManager#setBorderStyle()
. ConfigureBorderStyle
inBorderStylePreset
and set it viaAnnotationPreferencesManager#setBorderStylePreset()
. -
AnnotationPreferencesManager#getBorderDashArray()
. UseBorderStylePreset#getDashArray()
on the border style preset returned viaAnnotationPreferencesManager#getBorderStylePreset()
. -
AnnotationPreferencesManager#setBorderDashArray()
. UseBorderStylePreset
set viaAnnotationPreferencesManager#setBorderStylePreset()
. -
PdfConfiguration.Builder#textSharingEnabled()
. UsePdfConfiguration.Builder#setEnabledShareFeatures()
withShareFeatures#TEXT_SELECTION_SHARING
,ShareFeatures.NOTE_ANNOTATION_SHARING
, andShareFeatures.FREE_TEXT_ANNOTATION_SHARING
instead. -
PdfConfiguration.Builder#embeddedFileSharingEnabled()
. UsePdfConfiguration.Builder#setEnabledShareFeatures()
withShareFeatures#EMBEDDED_FILE_SHARING
instead. -
PdfConfiguration.Builder#sharingNoteEditorContentEnabled()
. UsePdfConfiguration.Builder#setEnabledShareFeatures()
withShareFeatures#NOTE_EDITOR_CONTENT_SHARING
instead. -
PdfConfiguration.Builder#setSignatureSavingEnabled()
. UsePdfConfiguration.Builder#signatureSavingStrategy()
instead. -
PdfConfiguration.Builder#setCustomerSignatureFeatureEnabled()
. UsePdfConfiguration.Builder#signatureSavingStrategy()
instead. -
PdfConfiguration#isTextSharingEnabled()
. UsePdfConfiguration#getEnabledShareFeatures()
and check ifShareFeatures#TEXT_SELECTION_SHARING
is enabled. -
PdfConfiguration#isEmbeddedFilesSharingEnabled()
. UsePdfConfiguration#getEnabledShareFeatures()
and check ifShareFeatures#EMBEDDED_FILE_SHARING
is enabled. -
PdfConfiguration#isSharingNoteEditorContentEnabled()
. UsePdfConfiguration#getEnabledShareFeatures()
and check ifShareFeatures#NOTE_EDITOR_CONTENT_SHARING
is enabled. -
PdfConfiguration#isSignatureSavingEnabled()
. UsePdfConfiguration#getSignatureSavingStrategy()
instead. -
PdfConfiguration#isCustomerSignatureFeatureEnabled()
. UsePdfConfiguration#getSignatureSavingStrategy()
instead. -
PdfActivityConfiguration.Builder#sharingNoteEditorContentEnabled()
. UsePdfActivityConfiguration.Builder#enabledShareFeatures()
withShareFeatures#NOTE_EDITOR_CONTENT_SHARING
instead. -
PdfActivityConfiguration.Builder#enableShare()
. UsePdfActivityConfiguration.Builder#enabledShareFeatures()
withShareFeatures.all()
instead. -
PdfActivityConfiguration.Builder#disableShare()
. UsePdfActivityConfiguration.Builder#enabledShareFeatures()
withShareFeatures.none()
instead. -
PdfActivityConfiguration.Builder#setSignatureSavingEnabled()
. UsePdfActivityConfiguration.Builder#signatureSavingStrategy()
instead. -
PdfActivityConfiguration.Builder#setCustomerSignatureFeatureEnabled()
. UsePdfActivityConfiguration.Builder#signatureSavingStrategy()
instead. -
PdfActivityConfiguration#isShareEnabled()
. UsePdfActivityConfiguration#getEnabledShareFeatures()
instead. -
ThumbnailBarMode#THUMBNAIL_BAR_MODE_DEFAULT
. UseThumbnailBarMode#THUMBNAIL_BAR_MODE_FLOATING
instead. -
PdfProcessorTask#addPdfToPage()
. UsePdfProcessorTask#mergePage()
instead. -
SearchOptions.Builder(Context)
. Use no parameter constructor instead. -
TextSearch(Context, PdfDocument, PdfConfiguration)
. UseTextSearch(PdfDocument, PdfConfiguration)
instead. -
Signer#OnSigningCompleteCallback
.Signer#signFormField()
is now blocking and no longer requires this callback. -
Signer#signFormField(SignatureFormField, BiometricSignatureData, OutputStream, OnSigningCompleteCallback)
. UseSigner#signFormField(SignerOptions)
instead. -
Signer#signFormField(SignerOptions, OnSigningCompleteCallback)
. UseSigner#signFormField(SignerOptions)
instead. -
Signer#signFormFieldAsync(SignatureFormField, BiometricSignatureData, OutputStream)
. UseSigner#signFormFieldAsync(SignerOptions)
instead. -
SignaturePickerFragment#setSignaturePickerOrientation()
. Pass in the desiredSignatureOptions
toSignaturePickerFragment#show()
instead. -
SignaturePickerFragment#showSignaturePicker()
. UseSignaturePickerFragment#show()
instead. -
AnnotationCreationController#getBorderStyle()
. Use border style viaBorderStylePreset#getBorderStyle()
returned byAnnotationCreationController#getBorderStylePreset()
.