Skip to content

Commit 40f07b2

Browse files
committed
Release 5.4.1
1 parent fc6c37f commit 40f07b2

File tree

9 files changed

+79
-27
lines changed

9 files changed

+79
-27
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 5.4.1 - 22 Feb 2026
2+
3+
- Updates to Nutrient iOS SDK 26.5.0. (#50888)
4+
- Fixes an iOS issue where the `AdapterBridge` couldn't retrieve the `PSPDFViewController` via FFI when using `NutrientView` with a platform adapter. (#50888)
5+
16
## 5.4.0 - 18 Feb 2026
27

38
- [**Beta**] Adds federated plugin architecture with platform-specific packages (`nutrient_flutter_platform_interface`, `nutrient_flutter_android`, `nutrient_flutter_ios`, `nutrient_flutter_web`) for native SDK bindings via JNI (Android), FFI (iOS), and `dart:js_interop` (Web). Refer to the [platform adapters](/guides/flutter/platform-adapters/) guide for details. (J#HYB-895)

android/src/main/java/com/pspdfkit/flutter/pspdfkit/util/DynamicColorResourcesHelper.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ object DynamicColorResourcesHelper {
187187

188188
val loader = ResourcesLoader()
189189
loader.addProvider(ResourcesProvider.loadFromTable(pfd, null))
190+
pfd.close()
190191
return loader
191192
} catch (e: Exception) {
192193
Log.e(TAG, "Failed to create color ResourcesLoader", e)

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191
);
192192
mainGroup = 97C146E51CF9000F007C117D;
193193
packageReferences = (
194-
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */,
194+
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */,
195195
);
196196
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
197197
projectDirPath = "";
@@ -533,7 +533,7 @@
533533
/* End XCConfigurationList section */
534534

535535
/* Begin XCLocalSwiftPackageReference section */
536-
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = {
536+
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = {
537537
isa = XCLocalSwiftPackageReference;
538538
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
539539
};

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: nutrient_example
22
description: Demonstrates how to use the Nutrient Flutter plugin.
3-
version: 5.4.0
3+
version: 5.4.1
44
homepage: https://nutrient.io/
55
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
66
environment:

ios/Classes/PspdfPlatformView.m

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,27 @@ @interface PspdfPlatformView() <PSPDFViewControllerDelegate>
5151
@property (nonatomic, strong) UIColor *themeSeparatorColor;
5252
@end
5353

54-
/// Parses a hex color string (e.g. "#FF0000" or "FF0000") into a UIColor.
54+
/// Parses a hex color string into a UIColor.
55+
/// Supports 6-character RGB ("#FF0000") and 8-character ARGB ("#80FF0000") formats.
5556
static UIColor *PSPDFColorFromHexString(NSString *hexString) {
5657
NSString *hex = [hexString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
5758
if ([hex hasPrefix:@"#"]) {
5859
hex = [hex substringFromIndex:1];
5960
}
60-
unsigned int rgb = 0;
61-
[[NSScanner scannerWithString:hex] scanHexInt:&rgb];
62-
CGFloat r = ((rgb & 0xFF0000) >> 16) / 255.0;
63-
CGFloat g = ((rgb & 0x00FF00) >> 8) / 255.0;
64-
CGFloat b = (rgb & 0x0000FF) / 255.0;
61+
unsigned int hexValue = 0;
62+
[[NSScanner scannerWithString:hex] scanHexInt:&hexValue];
63+
if (hex.length == 8) {
64+
// ARGB format: #AARRGGBB
65+
CGFloat a = ((hexValue >> 24) & 0xFF) / 255.0;
66+
CGFloat r = ((hexValue >> 16) & 0xFF) / 255.0;
67+
CGFloat g = ((hexValue >> 8) & 0xFF) / 255.0;
68+
CGFloat b = (hexValue & 0xFF) / 255.0;
69+
return [UIColor colorWithRed:r green:g blue:b alpha:a];
70+
}
71+
// 6-character RGB format: #RRGGBB
72+
CGFloat r = ((hexValue >> 16) & 0xFF) / 255.0;
73+
CGFloat g = ((hexValue >> 8) & 0xFF) / 255.0;
74+
CGFloat b = (hexValue & 0xFF) / 255.0;
6575
return [UIColor colorWithRed:r green:g blue:b alpha:1.0];
6676
}
6777

@@ -380,6 +390,9 @@ - (instancetype)initWithFrame:(CGRect)frame viewIdentifier:(int64_t)viewId argum
380390

381391
[_platformViewImpl setViewControllerWithController:_pdfViewController];
382392

393+
// Apply stored theme colors to PSPDFKit UI components
394+
[self applyStoredThemeColors];
395+
383396
[_channel setMethodCallHandler:^(FlutterMethodCall * _Nonnull call, FlutterResult _Nonnull result) {
384397
[weakSelf handleMethodCall:call result:result];
385398
}];
@@ -479,6 +492,46 @@ - (void)cleanup {
479492
[self.navigationController removeFromParentViewController];
480493
}
481494

495+
- (void)applyStoredThemeColors {
496+
// Annotation toolbar colors
497+
if (_themeSubToolbarBackgroundColor || _themeSubToolbarIconColor ||
498+
_themeSubToolbarActiveIconColor || _themeSubToolbarActiveToolBackgroundColor) {
499+
PSPDFAnnotationToolbar *annotationToolbar = _pdfViewController.annotationToolbarController.annotationToolbar;
500+
if (annotationToolbar) {
501+
if (_themeSubToolbarBackgroundColor) {
502+
annotationToolbar.barTintColor = _themeSubToolbarBackgroundColor;
503+
}
504+
if (_themeSubToolbarIconColor) {
505+
annotationToolbar.tintColor = _themeSubToolbarIconColor;
506+
}
507+
if (_themeSubToolbarActiveIconColor) {
508+
annotationToolbar.selectedTintColor = _themeSubToolbarActiveIconColor;
509+
}
510+
if (_themeSubToolbarActiveToolBackgroundColor) {
511+
annotationToolbar.selectedBackgroundColor = _themeSubToolbarActiveToolBackgroundColor;
512+
}
513+
}
514+
}
515+
516+
// Search highlight color via UIAppearance
517+
if (_themeSearchHighlightColor) {
518+
[PSPDFSearchHighlightView appearance].selectionBackgroundColor = _themeSearchHighlightColor;
519+
}
520+
521+
// Text selection highlight color
522+
if (_themeSelectionTextHighlightColor) {
523+
[PSPDFPageView appearance].highlightColor = _themeSelectionTextHighlightColor;
524+
}
525+
526+
// Separator color
527+
if (_themeSeparatorColor) {
528+
_navigationController.navigationBar.standardAppearance.shadowColor = _themeSeparatorColor;
529+
if (@available(iOS 15.0, *)) {
530+
_navigationController.navigationBar.scrollEdgeAppearance.shadowColor = _themeSeparatorColor;
531+
}
532+
}
533+
}
534+
482535
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
483536
[PspdfkitFlutterHelper processMethodCall:call result:result forViewController:self.pdfViewController];
484537
}

ios/nutrient_flutter.podspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
Pod::Spec.new do |s|
77
s.name = "nutrient_flutter"
8-
s.version = "5.4.0"
8+
s.version = "5.4.1"
99
s.homepage = "https://nutrient.io"
1010
s.documentation_url = "https://nutrient.io/guides/flutter"
1111
s.license = { type: "Commercial", file: "../LICENSE" }
@@ -18,10 +18,10 @@ Pod::Spec.new do |s|
1818
s.source_files = "Classes/**/*.{h,m,swift}"
1919
s.public_header_files = "Classes/**/*.h"
2020
s.dependency("Flutter")
21-
s.dependency("PSPDFKit", "26.3.0")
22-
s.dependency("Instant", "26.3.0")
21+
s.dependency("PSPDFKit", "26.5.0")
22+
s.dependency("Instant", "26.5.0")
2323
s.swift_version = "5.0"
2424
s.platform = :ios, "16.0"
25-
s.weak_frameworks = ['PencilKit']
25+
s.weak_frameworks = ["PencilKit"]
2626
s.pod_target_xcconfig = { "DEFINES_MODULE" => "YES", "SWIFT_INSTALL_OBJC_HEADER" => "NO" }
2727
end

lib/src/widgets/adapter_bridge_native.dart

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,18 +266,11 @@ class AdapterBridge {
266266
/// Returns null if the view controller is not registered or FFI fails.
267267
PSPDFViewController? _getPSPDFViewControllerFromNative() {
268268
try {
269-
// Load the iOS bindings to access the nutrient_get_view_controller function.
269+
// Call the FFI function to get the view controller pointer.
270270
// This function is defined in nutrient_flutter's PspdfPlatformView.m
271271
// and declared in nutrient_flutter_ios's NutrientFFI.h header.
272-
final iosBindings = ios_bindings.NutrientIOSBindings(
273-
ffi.DynamicLibrary.process(),
274-
);
275-
276-
// Call the FFI function to get the view controller pointer.
277-
// Note: This requires the iOS FFI bindings to be regenerated after
278-
// the nutrient_get_view_controller function was added to NutrientFFI.h.
279272
final viewControllerPointer =
280-
iosBindings.nutrient_get_view_controller(_viewId);
273+
ios_bindings.nutrient_get_view_controller(_viewId);
281274

282275
if (viewControllerPointer == ffi.nullptr) {
283276
debugPrint(

pubspec.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: nutrient_flutter
22
description: A Flutter plugin providing a feature-rich PDF viewing and editing experience to your users with the powerful Nutrient PDF SDK.
3-
version: 5.4.0
3+
version: 5.4.1
44
homepage: https://nutrient.io/
55
repository: https://github.com/PSPDFKit/pspdfkit-flutter
66
issue_tracker: https://support.nutrient.io/hc/en-us/requests/new
@@ -19,7 +19,7 @@ dependencies:
1919
# Platform interface and adapters for native SDK access
2020
nutrient_flutter_platform_interface: ^1.0.0
2121
nutrient_flutter_android: ^1.0.0
22-
nutrient_flutter_ios: ^1.0.0
22+
nutrient_flutter_ios: ^1.0.1
2323
nutrient_flutter_web: ^1.0.0
2424

2525

@@ -44,7 +44,5 @@ dev_dependencies:
4444
build_runner: ^2.2.1
4545
mockito: ^5.3.1
4646

47-
48-
# Ignore false positives for security scanning
4947
false_secrets:
5048
- example/lib/utils/jwt_util.dart

pubspec.yaml.overrides.backup

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# For local development until packages are published to pub.dev
21
dependency_overrides:
32
nutrient_flutter_platform_interface:
43
path: ../nutrient_flutter_platform_interface
@@ -8,3 +7,6 @@ dependency_overrides:
87
path: ../nutrient_flutter_ios
98
nutrient_flutter_web:
109
path: ../nutrient_flutter_web
10+
11+
12+
# Ignore false positives for security scanning

0 commit comments

Comments
 (0)