Bläddra i källkod

ComPDFKit(flutter) - ios端接口测试调整,优化UI效果

liuxiaolong 2 månader sedan
förälder
incheckning
a800ef49eb
41 ändrade filer med 116 tillägg och 80 borttagningar
  1. 14 0
      CHANGELOG.md
  2. 1 1
      LICENSE
  3. 1 1
      android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/CompdfkitFlutterPlugin.java
  4. 1 1
      android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/constants/CPDFConstants.java
  5. 1 1
      android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/platformview/CPDFViewCtrlFactory.java
  6. 1 1
      android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/platformview/CPDFViewCtrlFlutter.java
  7. 1 1
      android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/plugin/BaseMethodChannelPlugin.java
  8. 4 2
      android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/plugin/CPDFDocumentPlugin.java
  9. 1 1
      android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/plugin/CPDFViewCtrlPlugin.java
  10. 1 1
      android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/plugin/ComPDFKitSDKPlugin.java
  11. 1 1
      android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/FileUtils.java
  12. 1 1
      example/android/app/src/main/java/com/compdfkit/flutter/example/MainActivity.java
  13. 3 3
      example/ios/Runner.xcodeproj/project.pbxproj
  14. 2 2
      example/ios/Runner/en.lproj/Localizable.strings
  15. 2 2
      example/ios/Runner/zh-Hans.lproj/Localizable.strings
  16. 1 1
      example/lib/cpdf_reader_widget_annotations_example.dart
  17. 1 1
      example/lib/cpdf_reader_widget_controller_example.dart
  18. 1 1
      example/lib/cpdf_reader_widget_dark_theme_example.dart
  19. 1 1
      example/lib/cpdf_reader_widget_example.dart
  20. 9 7
      example/lib/cpdf_reader_widget_security_example.dart
  21. 1 1
      example/lib/examples.dart
  22. 1 1
      example/lib/main.dart
  23. 2 2
      example/lib/page/cpdf_reader_widget_display_setting_page.dart
  24. 1 1
      example/lib/page/cpdf_reader_widget_switch_preview_mode_page.dart
  25. 2 2
      example/lib/page/settings_page.dart
  26. 23 3
      example/lib/theme/themes.dart
  27. 1 1
      example/lib/utils/file_util.dart
  28. 1 1
      example/lib/widgets/cpdf_app_bar.dart
  29. 1 1
      example/lib/widgets/cpdf_fun_item.dart
  30. 1 1
      ios/Classes/CPDFConstants.swift
  31. 22 19
      ios/Classes/ColorHelper.swift
  32. 3 8
      ios/Classes/reader/CPDFDocumentPlugin.swift
  33. 1 1
      lib/compdfkit.dart
  34. 1 1
      lib/configuration/attributes/cpdf_annot_attr.dart
  35. 1 1
      lib/configuration/cpdf_configuration.dart
  36. 1 1
      lib/configuration/cpdf_options.dart
  37. 1 1
      lib/document/cpdf_document.dart
  38. 1 1
      lib/document/cpdf_watermark.dart
  39. 1 1
      lib/util/extension/cpdf_color_extension.dart
  40. 1 1
      lib/widgets/cpdf_reader_widget.dart
  41. 1 1
      lib/widgets/cpdf_reader_widget_controller.dart

+ 14 - 0
CHANGELOG.md

@@ -1,3 +1,17 @@
+## 2.2.0
+* Added the features support for ComPDFKit PDF SDK for iOS [iOS V2.2.1](https://www.compdf.com/pdf-sdk/changelog-ios#v2-2-1).
+* Added the features support for ComPDFKit PDF SDK for Android [Android V2.2.1](https://www.compdf.com/pdf-sdk/changelog-android#v2-2-1).
+* Added font import interface
+* Added watermark add interface
+* Added security settings interface
+* Added view interfaces such as opening thumbnail list, preview settings, watermark editing, and security settings
+* For more details on the newly added APIs, please refer to `cpdf_reader_widget_controller.dart` and `cpdf_document.dart`.
+* Fixed the crash problem when initializing SDK for some devices
+* Fixed the possible crash problem when importing xfdf annotations for some documents
+* Fixed the problem of adding Ink annotations on iOS without annotation author information
+* Fixed the issue where `hasChange()` is true when the document is not modified
+* For more fixes, please see the above changelogs for iOS and Android
+
 ## 2.2.0
 * Added the features support for ComPDFKit PDF SDK for iOS [iOS V2.2.0](https://www.compdf.com/pdf-sdk/changelog-ios#v2-2-0).
 * Added the features support for ComPDFKit PDF SDK for Android  [Android V2.2.0](https://www.compdf.com/pdf-sdk/changelog-android#v2-2-0).

+ 1 - 1
LICENSE

@@ -1,3 +1,3 @@
-Copyright (C) 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+Copyright (C) 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 No part of this document can be reproduced, transferred, distributed or stored in any
 format without the prior written permission of PDF Technologies.

+ 1 - 1
android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/CompdfkitFlutterPlugin.java

@@ -1,5 +1,5 @@
 /**
- * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  *
  * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/constants/CPDFConstants.java

@@ -1,5 +1,5 @@
 /*
- * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  *
  * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/platformview/CPDFViewCtrlFactory.java

@@ -1,5 +1,5 @@
 /*
- * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  *
  * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/platformview/CPDFViewCtrlFlutter.java

@@ -1,5 +1,5 @@
 /*
- * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  *
  * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/plugin/BaseMethodChannelPlugin.java

@@ -1,5 +1,5 @@
 /**
- * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  * <p>
  * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 4 - 2
android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/plugin/CPDFDocumentPlugin.java

@@ -1,5 +1,5 @@
 /*
- * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  *
  * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
@@ -417,7 +417,9 @@ public class CPDFDocumentPlugin extends BaseMethodChannelPlugin {
         watermark.setHorizalign(Horizalign.WATERMARK_HORIZALIGN_RIGHT);
         break;
     }
-    watermark.setRotation(rotation);
+    float a = (float) -(rotation * Math.PI / 180);
+    Log.e("水印", "rotation:"+ a);
+    watermark.setRotation(a);
     watermark.setVertOffset(
         verticalOffset);// Translation offset relative to the vertical position. Positive values move downward, while negative values move upward.
     watermark.setHorizOffset(

+ 1 - 1
android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/plugin/CPDFViewCtrlPlugin.java

@@ -1,5 +1,5 @@
 /*
- * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  *
  * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/plugin/ComPDFKitSDKPlugin.java

@@ -1,5 +1,5 @@
 /**
- * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  * <p>
  * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
android/src/main/java/com/compdfkit/flutter/compdfkit_flutter/utils/FileUtils.java

@@ -1,5 +1,5 @@
 /*
- * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  *
  * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
example/android/app/src/main/java/com/compdfkit/flutter/example/MainActivity.java

@@ -1,5 +1,5 @@
 /**
- * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  *
  * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 3 - 3
example/ios/Runner.xcodeproj/project.pbxproj

@@ -490,7 +490,7 @@
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 2.2.0;
-				DEVELOPMENT_TEAM = 59AC9PMNH2;
+				DEVELOPMENT_TEAM = 4GGQPGRTSV;
 				ENABLE_BITCODE = NO;
 				FLUTTER_BUILD_NAME = 2.2.0;
 				FLUTTER_BUILD_NUMBER = 2.2.0;
@@ -680,7 +680,7 @@
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 2.2.0;
-				DEVELOPMENT_TEAM = 59AC9PMNH2;
+				DEVELOPMENT_TEAM = 4GGQPGRTSV;
 				ENABLE_BITCODE = NO;
 				FLUTTER_BUILD_NAME = 2.2.0;
 				FLUTTER_BUILD_NUMBER = 2.2.0;
@@ -709,7 +709,7 @@
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 2.2.0;
-				DEVELOPMENT_TEAM = 59AC9PMNH2;
+				DEVELOPMENT_TEAM = 4GGQPGRTSV;
 				ENABLE_BITCODE = NO;
 				FLUTTER_BUILD_NAME = 2.2.0;
 				FLUTTER_BUILD_NUMBER = 2.2.0;

+ 2 - 2
example/ios/Runner/en.lproj/Localizable.strings

@@ -5,7 +5,7 @@
   Localizable.strings
   PDFViewer
 
- //  Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ //  Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  //
  //  THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  //  AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
@@ -37,7 +37,7 @@
 "support@compdf.com" = "support@compdf.com";
 "Technical Supports" = "Technical Support";
 "Mail account is not set up!" = "Mail account is not set up!";
-"© 2014-2024 PDF Technologies, Inc. All Rights Reserved." = "© 2014-2024 PDF Technologies, Inc. All Rights Reserved.";
+"© 2014-2025 PDF Technologies, Inc. All Rights Reserved." = "© 2014-2025 PDF Technologies, Inc. All Rights Reserved.";
 "Privacy Policy" = "Privacy Policy";
 "Service Terms" = "Service Terms";
 "Click to Open & Process" = "Click to Open & Process";

+ 2 - 2
example/ios/Runner/zh-Hans.lproj/Localizable.strings

@@ -2,7 +2,7 @@
   Localizable.strings
   PDFViewer
 
- //  Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ //  Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  //
  //  THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  //  AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
@@ -34,7 +34,7 @@
 "support@compdf.com" = "support@compdf.com";
 "Technical Supports" = "ComPDFKit技术支持请求";
 "Mail account is not set up!" = "尚未设置Email邮箱";
-"© 2014-2024 PDF Technologies, Inc. All Rights Reserved." = "© 2014-2024 PDF Technologies, Inc. All Rights Reserved.";
+"© 2014-2025 PDF Technologies, Inc. All Rights Reserved." = "© 2014-2025 PDF Technologies, Inc. All Rights Reserved.";
 "Privacy Policy" = "隐私协议";
 "Service Terms" = "服务条款";
 "Click to Open & Process" = "点击打开 & 处理文档";

+ 1 - 1
example/lib/cpdf_reader_widget_annotations_example.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
example/lib/cpdf_reader_widget_controller_example.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
example/lib/cpdf_reader_widget_dark_theme_example.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
example/lib/cpdf_reader_widget_example.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 9 - 7
example/lib/cpdf_reader_widget_security_example.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
@@ -99,14 +99,19 @@ class _CPDFReaderWidgetSecurityExampleState
         await controller.document.createWatermark(CPDFWatermark.text(
             textContent: 'Flutter',
             scale: 1.0,
-            fontSize: 50,
-            textColor: Colors.deepOrange,
+            fontSize: 60,
+            rotation: 0,
+            horizontalAlignment: CPDFWatermarkHorizontalAlignment.center,
+            verticalAlignment: CPDFWatermarkVerticalAlignment.center,
+            textColor: Colors.red,
             pages: [0, 1, 2, 3]));
         break;
       case 'Create Image Watermark':
         File imageFile = await extractAsset(context, 'images/logo.png');
         await controller.document.createWatermark(CPDFWatermark.image(
           imagePath: imageFile.path,
+          opacity: 1,
+          rotation: 45,
           pages: [0, 1, 2, 3],
           horizontalAlignment: CPDFWatermarkHorizontalAlignment.center,
           verticalAlignment: CPDFWatermarkVerticalAlignment.center,
@@ -120,10 +125,7 @@ class _CPDFReaderWidgetSecurityExampleState
           await controller.document.createWatermark(CPDFWatermark.image(
             imagePath: pickerResult.files.first.path!,
             pages: [0, 1, 2, 3],
-            scale: 0.5,
-            horizontalSpacing: 50,
-            verticalSpacing: 50,
-            opacity: 0.5,
+            scale: 1,
             horizontalAlignment: CPDFWatermarkHorizontalAlignment.center,
             verticalAlignment: CPDFWatermarkVerticalAlignment.center,
           ));

+ 1 - 1
example/lib/examples.dart

@@ -1,5 +1,5 @@
 /*
- * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  *
  * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
example/lib/main.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 2 - 2
example/lib/page/cpdf_reader_widget_display_setting_page.dart

@@ -1,5 +1,5 @@
 /*
- * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  *
  * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
@@ -267,7 +267,7 @@ class _CpdfReaderWidgetDisplaySettingPageState
       onTap: onTap,
       title: Text(title, style: Theme.of(context).textTheme.bodyMedium),
       trailing: isCheck
-          ? Icon(Icons.check, color: Theme.of(context).primaryColor)
+          ? Icon(Icons.check, color: Theme.of(context).colorScheme.primary)
           : null,
     );
   }

+ 1 - 1
example/lib/page/cpdf_reader_widget_switch_preview_mode_page.dart

@@ -1,5 +1,5 @@
 /*
- * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  *
  * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 2 - 2
example/lib/page/settings_page.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
@@ -62,7 +62,7 @@ class SettingsPage extends StatelessWidget {
                 mainAxisAlignment: MainAxisAlignment.end,
                 children: [
                   Text(
-                    '© 2014-2024 PDF Technologies, Inc. All Rights Reserved.',
+                    '© 2014-2025 PDF Technologies, Inc. All Rights Reserved.',
                     style: Theme.of(context)
                         .textTheme
                         .bodySmall

+ 23 - 3
example/lib/theme/themes.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
@@ -61,7 +61,7 @@ final ThemeData darkTheme = ThemeData(
     brightness: Brightness.dark,
     scaffoldBackgroundColor: Colors.black,
     colorScheme: const ColorScheme.dark(
-        primary: Color(0xFF222429),
+        primary: Colors.blue,
         surface: Color(0xFF222429),
         onPrimary: Colors.white,
         onSecondary: Colors.white),
@@ -80,4 +80,24 @@ final ThemeData darkTheme = ThemeData(
         systemOverlayStyle:
             SystemUiOverlayStyle(systemNavigationBarColor: Color(0xFF222429))),
     elevatedButtonTheme: ElevatedButtonThemeData(
-        style: ElevatedButton.styleFrom(foregroundColor: Colors.blue)));
+        style: ElevatedButton.styleFrom(foregroundColor: Colors.blue)),
+    switchTheme: SwitchThemeData(
+      thumbColor: WidgetStateProperty.resolveWith((status){
+        if(status.contains(WidgetState.selected)) {
+          return Colors.blue;
+        }
+        return Colors.grey.shade400;
+      } ),
+      trackColor: WidgetStateProperty.resolveWith((status){
+        if(status.contains(WidgetState.selected)) {
+          return Colors.blue.shade50;
+        }
+        return Colors.grey.shade100;
+      }),
+      trackOutlineColor: WidgetStateProperty.resolveWith((status){
+        if(status.contains(WidgetState.selected)) {
+          return Colors.blue.shade50;
+        }
+        return Colors.grey.shade100;
+      }),
+    ));

+ 1 - 1
example/lib/utils/file_util.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
example/lib/widgets/cpdf_app_bar.dart

@@ -1,5 +1,5 @@
 /*
- * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  *
  * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
example/lib/widgets/cpdf_fun_item.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
ios/Classes/CPDFConstants.swift

@@ -112,7 +112,7 @@ class CPDFConstants {
     
     static let createWatermark = "create_watermark"
     
-    static let removeAllWatermark = "remove_all_watermark"
+    static let removeAllWatermark = "remove_all_watermarks"
     
     
 }

+ 22 - 19
ios/Classes/ColorHelper.swift

@@ -10,25 +10,28 @@ import UIKit
 
 class ColorHelper {
     static func colorWithHexString (hex:String) -> UIColor {
-        var cString:String = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
-
-        if (cString.hasPrefix("#")) {
-            cString.remove(at: cString.startIndex)
-        }
-
-        if ((cString.count) != 6) {
-            return UIColor.gray
-        }
-
-        var rgbValue:UInt64 = 0
-        Scanner(string: cString).scanHexInt64(&rgbValue)
-
-        return UIColor(
-            red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0,
-            green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0,
-            blue: CGFloat(rgbValue & 0x0000FF) / 255.0,
-            alpha: CGFloat(1.0)
-        )
+        var hexString = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
+                
+                // 检查颜色字符串是否有效
+                if hexString.hasPrefix("#") {
+                    hexString.remove(at: hexString.startIndex)
+                }
+                
+                // 确保字符串长度是8(包括透明度部分)
+                if hexString.count == 8 {
+                    var rgba: UInt64 = 0
+                    Scanner(string: hexString).scanHexInt64(&rgba)
+                    
+                    let a = CGFloat((rgba >> 24) & 0xFF) / 255.0
+                    let r = CGFloat((rgba >> 16) & 0xFF) / 255.0
+                    let g = CGFloat((rgba >> 8) & 0xFF) / 255.0
+                    let b = CGFloat(rgba & 0xFF) / 255.0
+                    
+                    return UIColor(red: r, green: g, blue: b, alpha: a)
+                } else {
+                    // 如果不是合法的8位Hex,返回透明的颜色或其他默认值
+                    return UIColor(white: 0.0, alpha: 0.0)
+                }
     }
 }
 

+ 3 - 8
ios/Classes/reader/CPDFDocumentPlugin.swift

@@ -235,9 +235,9 @@ public class CPDFDocumentPlugin {
                 for watermark in watrmarks {
                     self.document?.removeWatermark(watermark)
                 }
-                
                 let url = self.document?.documentURL
                 self.document?.write(to: url, isSaveFontSubset: true)
+                self.pdfViewController?.pdfListView?.layoutDocumentView()
             default:
                 result(FlutterMethodNotImplemented)
             }
@@ -316,7 +316,7 @@ public class CPDFDocumentPlugin {
             let textWatermark = CPDFWatermark(document: self.document, type: .text)
             
             textWatermark?.text = textContent
-           
+            print("textColor:\(textColor)")
             let font = CPDFFont(familyName: "Helvetica", fontStyle: "")
             textWatermark?.cFont = font
             textWatermark?.opacity = opacity
@@ -338,9 +338,6 @@ public class CPDFDocumentPlugin {
             }
             
             self.document?.addWatermark(textWatermark)
-            
-            let url = self.document?.documentURL
-            self.document?.write(to: url, isSaveFontSubset: true)
         } else if type == "image" {
             let imageWatermark = CPDFWatermark(document: self.document, type: .image)
             
@@ -362,10 +359,8 @@ public class CPDFDocumentPlugin {
             }
             
             self.document?.addWatermark(imageWatermark)
-            
-            let url = self.document?.documentURL
-            self.document?.write(to: url, isSaveFontSubset: true)
         }
+        self.pdfViewController?.pdfListView?.layoutDocumentView()
     }
     
     func getValue<T>(from info: [String: Any]?, key: String, defaultValue: T) -> T {

+ 1 - 1
lib/compdfkit.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
lib/configuration/attributes/cpdf_annot_attr.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
lib/configuration/cpdf_configuration.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
lib/configuration/cpdf_options.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
lib/document/cpdf_document.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
lib/document/cpdf_watermark.dart

@@ -1,5 +1,5 @@
 /*
- * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+ * Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  *
  * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
lib/util/extension/cpdf_color_extension.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
lib/widgets/cpdf_reader_widget.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.

+ 1 - 1
lib/widgets/cpdf_reader_widget_controller.dart

@@ -1,4 +1,4 @@
-// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
+// Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
 //
 // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.