Skip to content

Commit ae6edea

Browse files
committed
Release 3.2.0
1 parent e0bd9c6 commit ae6edea

24 files changed

+172
-68
lines changed

CHANGELOG.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
## 3.2.0 - 20 Oct 2025
2+
3+
- Adds the page size to the existing `getPageInfo` API call. (J#HYB-888)
4+
- Adds the `androidEnableStylusOnDetection` option to the `PDFConfiguration` object to control stylus detection on Android. (J#HYB-893)
5+
- Updates related to Nutrient Android SDK 10.7.0.
6+
- Updates related to Nutrient iOS SDK 26.1.0.
7+
- Fixes image annotations being incorrectly placed when added on pages with a rotation or crop box. (J#IOS-767)
8+
- Fixes an issue where the `presentInstant` API call would never resolve its promise on iOS. (J#HYB-894)
9+
- Fixes an issue where the `onDocumentLoadFailed` callback wasn`t triggered for invalid documents on iOS. (J#HYB-885)
10+
111
## 3.1.1 - 19 Sep 2025
212

3-
- Fixes an issue where the `setLicenseKey` API does not run synchronously on Android. (J#HYB-881)
13+
- Fixes an issue where the `setLicenseKey` API didn’t run synchronously on Android. (J#HYB-881)
414
- Fixes an issue where the `FormFieldEvent.VALUES_UPDATED` event returned incomplete objects. (J#HYB-884)
515

616
## 3.1.0 - 10 Sep 2025
@@ -99,11 +109,11 @@ _[Migration guide](https://www.nutrient.io/guides/react-native/migration-guides/
99109
- Updates to Nutrient iOS SDK 14.5.0.
100110
- Updates Android `minSdkVersion` to API 24.
101111
- Updates the iOS deployment target to iOS 16. (#46035)
102-
- Fixes an issue where the `pageMargins` property used by the PDF generation API wasn't being used by Android. (J#HYB-555)
112+
- Fixes an issue where the `pageMargins` property used by the PDF generation API wasnt being used by Android. (J#HYB-555)
103113
- Fixes an issue where the `documentPageChanged` event fired while the page change was still in progress on iOS. (J#HYB-644)
104114
- Fixes an issue where the `getConfiguration` API on Android returned inaccurate results. (J#HYB-648)
105-
- Removes the measurements `point` unit, as it isn't supported anymore. (#46035)
106-
- Removes the `iOSAllowedMenuAction` configuration property, as it isn't supported anymore. (#46035)
115+
- Removes the measurements `point` unit, as it isnt supported anymore. (#46035)
116+
- Removes the `iOSAllowedMenuAction` configuration property, as it isnt supported anymore. (#46035)
107117

108118
## 2.15.0 - 13 Dec 2024
109119

@@ -119,7 +129,7 @@ _[Migration guide](https://www.nutrient.io/guides/react-native/migration-guides/
119129
- Adds the ability to hide the main toolbar on Android using a combination of configuration and style properties. (J#HYB-431)
120130
- Updates to Nutrient Android SDK 2024.6.1.
121131
- Updates to Nutrient iOS SDK 14.1.1.
122-
- Fixes an issue where the correct items weren't rendered when using the `menuItemGrouping` configuration property. (J#HYB-432)
132+
- Fixes an issue where the correct items werent rendered when using the `menuItemGrouping` configuration property. (J#HYB-432)
123133
- Fixes an issue where a crash occurred when using the `toolbar.toolbarMenuItems` property and `enterAnnotationCreationMode` API on Android. (J#HYB-517)
124134
- Fixes an issue where some annotations would not be deleted on iOS when using the `removeAnnotations` API. (J#HYB-518)
125135

@@ -130,9 +140,9 @@ _[Migration guide](https://www.nutrient.io/guides/react-native/migration-guides/
130140
- Adds support to select and deselect annotations programmatically. (J#HYB-447)
131141
- Updates to PSPDFKit 2024.5.1 for Android.
132142
- Updates to PSPDFKit 13.9.1 for iOS.
133-
- Fixes an issue where certain annotation presets weren't applied correctly. (J#HYB-395)
143+
- Fixes an issue where certain annotation presets werent applied correctly. (J#HYB-395)
134144
- Fixes an issue where custom toolbar buttons were not applied on the Android toolbar. (J#HYB-482)
135-
- Fixes an issue where the `annotationTypes` parameter wasn't honored by the `processAnnotations` API. (J#HYB-495)
145+
- Fixes an issue where the `annotationTypes` parameter wasnt honored by the `processAnnotations` API. (J#HYB-495)
136146
- Fixes an issue where the `onDocumentLoadFailed` callback was not triggered when an incorrect document password was specified on Android. (J#HYB-491)
137147
- Fixes an issue where some measurement annotation presets were not applied when specified. (J#HYB-492)
138148

@@ -153,8 +163,8 @@ _[Migration guide](https://www.nutrient.io/guides/react-native/migration-guides/
153163
- Adds support for opening PDF documents from a remote URL. (J#HYB-354)
154164
- Updates `setAnnotationFlags` and `getAnnotationFlags` APIs to support using annotation `name` as an identifier. (J#HYB-372)
155165
- Fixes an issue where calling `exitCurrentlyActiveMode` while not in annotation editing mode generates an exception on iOS. (J#HYB-373)
156-
- Fixes an issue where the annotation `uuid` isn't included in `onAnnotationTapped` callbacks. (J#HYB-374)
157-
- Fixes an issue where Instant configuration wasn't applied when using the `presentInstant` API on iOS. (J#HYB-375)
166+
- Fixes an issue where the annotation `uuid` isnt included in `onAnnotationTapped` callbacks. (J#HYB-374)
167+
- Fixes an issue where Instant configuration wasnt applied when using the `presentInstant` API on iOS. (J#HYB-375)
158168

159169
## 2.10.0 - 06 May 2024
160170

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Contains gradle configuration constants
1616
*/
1717
ext {
18-
NUTRIENT_VERSION = '10.5.0'
18+
NUTRIENT_VERSION = '10.7.0'
1919
}
2020

2121
buildscript {

android/src/main/java/com/pspdfkit/react/ConfigurationAdapter.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public class ConfigurationAdapter {
9595
private static final String SHOW_SETTINGS_MENU = "showSettingsMenu";
9696
private static final String SHOW_DEFAULT_TOOLBAR = "showDefaultToolbar";
9797
private static final String SHOW_ACTION_BUTTONS = "showActionButtons";
98+
private static final String ENABLE_STYLUS_ON_DETECTION = "enableStylusOnDetection";
9899

99100
// Thumbnail Options
100101
private static final String SHOW_THUMBNAIL_BAR = "showThumbnailBar";
@@ -163,6 +164,7 @@ public ConfigurationAdapter(@NonNull final Context context, ReadableMap configur
163164
boolean hasConfiguration = iterator.hasNextKey();
164165
this.configuration = new PdfActivityConfiguration.Builder(context);
165166
this.configuration.contentEditingEnabled(false);
167+
this.configuration.immersiveModeEnabled(false);
166168
if (hasConfiguration) {
167169
String key;
168170

@@ -334,6 +336,10 @@ public ConfigurationAdapter(@NonNull final Context context, ReadableMap configur
334336
if (key != null) {
335337
configureShowActionButtons(configuration.getBoolean(key));
336338
}
339+
key = getKeyOrNull(configuration, ENABLE_STYLUS_ON_DETECTION);
340+
if (key != null) {
341+
configureEnableStylusOnDetection(configuration.getBoolean(key));
342+
}
337343
}
338344
}
339345

@@ -496,7 +502,7 @@ private void configureSignatureSavingStrategy(@Nullable final String signatureSa
496502
}
497503

498504
private void configureImmersiveMode(final boolean immersiveMode) {
499-
configuration.useImmersiveMode(immersiveMode);
505+
configuration.immersiveModeEnabled(immersiveMode);
500506
}
501507

502508
private void configureShowThumbnailBar(@Nullable final String showThumbnailBar) {
@@ -673,6 +679,10 @@ private void configureShowActionButtons(final boolean showActionButtons) {
673679
configuration.navigationButtonsEnabled(showActionButtons);
674680
}
675681

682+
private void configureEnableStylusOnDetection(final boolean enableStylus) {
683+
configuration.stylusOnDetectionEnabled(enableStylus);
684+
}
685+
676686
public PdfActivityConfiguration build() {
677687
return configuration.build();
678688
}

android/src/main/java/com/pspdfkit/react/PDFDocumentModule.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,17 @@ class PDFDocumentModule(reactContext: ReactApplicationContext) : ReactContextBas
9191
@ReactMethod fun getPageInfo(reference: Int, pageIndex: Int, promise: Promise) {
9292
try {
9393
val rotation = this.getDocument(reference)?.document?.getPageRotation(pageIndex);
94+
val size = this.getDocument(reference)?.document?.getPageSize(pageIndex);
9495
val result = Arguments.createMap()
9596
if (rotation != null) {
9697
result.putInt("savedRotation", rotation)
9798
}
99+
if (size != null) {
100+
val sizeMap = Arguments.createMap()
101+
sizeMap.putDouble("height", size.height.toDouble())
102+
sizeMap.putDouble("width", size.width.toDouble())
103+
result.putMap("size", sizeMap)
104+
}
98105
promise.resolve(result);
99106
} catch (e: Throwable) {
100107
promise.reject("getPageInfo error", e)

android/src/main/java/com/pspdfkit/react/RNInstantPdfActivity.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@ public void onSyncError(@NonNull InstantPdfDocument instantDocument, @NonNull In
3232
@Override
3333
public void onSyncFinished(@NonNull InstantPdfDocument instantDocument) {
3434
super.onSyncFinished(instantDocument);
35-
Log.d("RNInstant::::::", "onSyncFinished: ");
3635
}
3736

3837
@Override
3938
public void onSyncStarted(@NonNull InstantPdfDocument instantDocument) {
4039
super.onSyncStarted(instantDocument);
41-
Log.d("RNInstant::::::", "onSyncStarted: ");
4240
}
4341
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.pspdfkit.react
2+
3+
import io.nutrient.domain.ai.AiAssistant
4+
5+
object SessionStorage {
6+
@Volatile
7+
private var aiAssistant: AiAssistant? = null
8+
9+
@JvmStatic
10+
fun getAiAssistant(): AiAssistant? = aiAssistant
11+
12+
@JvmStatic
13+
fun setAiAssistant(assistant: AiAssistant?) {
14+
aiAssistant = assistant
15+
}
16+
}
17+
18+

android/src/main/java/com/pspdfkit/views/PdfView.java

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@
4848
import com.facebook.react.uimanager.events.EventDispatcher;
4949
import com.pspdfkit.LicenseFeature;
5050
import com.pspdfkit.PSPDFKit;
51+
import com.pspdfkit.ai.AiAssistantHelpersKt;
5152
import com.pspdfkit.annotations.Annotation;
5253
import com.pspdfkit.annotations.AnnotationFlags;
5354
import com.pspdfkit.annotations.AnnotationType;
5455
import com.pspdfkit.annotations.configuration.FreeTextAnnotationConfiguration;
56+
import com.pspdfkit.configuration.PdfConfiguration;
5557
import com.pspdfkit.configuration.activity.PdfActivityConfiguration;
5658
import com.pspdfkit.configuration.search.SearchType;
5759
import com.pspdfkit.configuration.sharing.ShareFeatures;
@@ -126,6 +128,7 @@
126128
import java.util.concurrent.atomic.AtomicBoolean;
127129

128130
import io.nutrient.data.models.AiAssistantConfiguration;
131+
import io.nutrient.data.models.DocumentIdentifiers;
129132
import io.nutrient.domain.ai.AiAssistant;
130133
import io.nutrient.domain.ai.AiAssistantKt;
131134
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
@@ -141,6 +144,7 @@
141144
import io.reactivex.rxjava3.schedulers.Schedulers;
142145
import io.reactivex.rxjava3.subjects.BehaviorSubject;
143146
import kotlin.Unit;
147+
import com.pspdfkit.react.SessionStorage;
144148

145149
/**
146150
* This view displays a {@link com.pspdfkit.ui.PdfFragment} and all associated toolbars.
@@ -257,8 +261,10 @@ public void doFrame(long frameTimeNanos) {
257261
}
258262
});
259263

260-
// Set a default configuration.
261-
configuration = new PdfActivityConfiguration.Builder(getContext()).build();
264+
// Set a default configuration. Immersive should be disabled for React Native.
265+
configuration = new PdfActivityConfiguration.Builder(getContext())
266+
.immersiveModeEnabled(false)
267+
.build();
262268

263269
// Generate an id to set on all fragments created by the PdfView.
264270
internalId = View.generateViewId();
@@ -648,8 +654,16 @@ private void postFragmentSetup(PdfUiFragment pdfFragment) {
648654
aiaConfiguration.getString("jwt"),
649655
aiaConfiguration.getString("sessionID"),
650656
aiaConfiguration.getString("userID"));
651-
AiAssistant aiAssistant = AiAssistantKt.standaloneAiAssistant(reactApplicationContext, aiaConfig);
652-
Objects.requireNonNull(pdfFragment.getDocument()).setAiAssistant(aiAssistant);
657+
658+
PdfDocument document = fragment.getDocument();
659+
DocumentIdentifiers documentIdentifiers = new DocumentIdentifiers(document.getDocumentSource().getDataProvider(),
660+
document.getPermanentId().toString(),
661+
null,
662+
document.getPermanentId().toString(),
663+
null);
664+
665+
AiAssistant aiAssistant = AiAssistantKt.standaloneAiAssistant(reactApplicationContext, aiaConfig, List.of(documentIdentifiers));
666+
SessionStorage.setAiAssistant(aiAssistant);
653667
}
654668
} catch (Exception e) {
655669
Log.w(TAG, "Failed to set AIA Configuration: " + e.getMessage());
@@ -1311,7 +1325,7 @@ public JSONObject convertConfiguration() {
13111325

13121326
config.put("userInterfaceViewMode", ConfigurationAdapter.getStringValueForConfigurationItem(fragment.getConfiguration().getUserInterfaceViewMode()));
13131327
config.put("inlineSearch", fragment.getConfiguration().getSearchType() == SearchType.INLINE ? true : false);
1314-
config.put("immersiveMode", fragment.getConfiguration().isImmersiveMode());
1328+
config.put("immersiveMode", fragment.getConfiguration().isImmersiveModeEnabled());
13151329
config.put("toolbarTitle", fragment.getConfiguration().getActivityTitle());
13161330
config.put("androidShowSearchAction", fragment.getConfiguration().isSearchEnabled());
13171331
config.put("androidShowOutlineAction", fragment.getConfiguration().isOutlineEnabled());
@@ -1320,6 +1334,7 @@ public JSONObject convertConfiguration() {
13201334
config.put("androidShowPrintAction", fragment.getConfiguration().isPrintingEnabled());
13211335
config.put("androidShowDocumentInfoView", fragment.getConfiguration().isDocumentInfoViewEnabled());
13221336
config.put("androidShowSettingsMenu", fragment.getConfiguration().isSettingsItemEnabled());
1337+
config.put("androidEnableStylusOnDetection", fragment.getConfiguration().getConfiguration().getEnableStylusOnDetection());
13231338

13241339
config.put("showThumbnailBar", ConfigurationAdapter.getStringValueForConfigurationItem(fragment.getConfiguration().getThumbnailBarMode()));
13251340
config.put("androidShowThumbnailGridAction", fragment.getConfiguration().isThumbnailGridEnabled());

ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFAnnotation.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ + (NSDictionary *)formElementToJSON:(PSPDFFormElement *)formElement {
7272
mutableJSON[@"type"] = @"textField";
7373
formElementJSON = [mutableJSON copy];
7474
} else {
75-
return nil; // Return nil if no conditions match
75+
formElementJSON = nil;
7676
}
7777

7878
return formElementJSON;

ios/RCTPSPDFKit/Helpers/SessionStorage.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import Foundation
1616

1717
@objc public enum CallbackType: Int {
1818
case onDocumentLoaded
19+
case onDocumentLoadFailed
1920
case onReady
2021
}
2122

ios/RCTPSPDFKit/NutrientNotificationCenter.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,14 @@ import PSPDFKit
203203
if (annotation is FormElement) {
204204
guard let eventId = annotation.uuid as String? ,
205205
lastProcessedId != eventId else { return }
206-
if let annotationJSON = try? RCTConvert.instantJSON(from: (annotation as! FormElement)) {
206+
if let formElement = annotation as? FormElement,
207+
let annotationJSON = try? RCTConvert.instantJSON(from: formElement) {
207208
let jsonData = ["event" : NotificationEvent.formFieldValuesUpdated.rawValue, "formField" : annotationJSON, "documentID" : documentID] as [String : Any]
208209
let payload = createEventPayload(jsonData: jsonData, componentID: componentID)
209210
eventEmitter?.sendEvent(withName:NotificationEvent.formFieldValuesUpdated.rawValue,
210211
body: payload)
211212
} else {
212-
// Could not decode annotation data
213+
// Could not decode annotation data or annotation was not a FormElement
213214
}
214215
lastProcessedId = eventId
215216
// Clear the ID after 100ms

0 commit comments

Comments
 (0)