Browse Source

ComPDFKit(flutter) - android 1.13.0-snapshot, flutter 废弃init方法

liuxiaolong 1 year ago
parent
commit
3705661514

+ 10 - 4
CHANGELOG.md

@@ -1,4 +1,12 @@
+## 1.13.0
+
+* Added the features support for ComPDFKit PDF SDK for iOS V1.13.0.
+* Added the features support for ComPDFKit PDF SDK for Android V1.13.0.
+* Added online license certification function.
+* Deprecated ~~`ComPDFKit.init`~~ method, please use `ComPDFKit.initialize(String key, {bool offline})` method.
+
 ## 1.12.0
+
 * Added the features support for ComPDFKit PDF SDK for iOS V1.12.0.
 * Added the features support for ComPDFKit PDF SDK for Android V1.12.0.
 * Added support for finding and replacing text in content editor mode, allowing to set ignore case, whole words only, and replace all.
@@ -6,13 +14,13 @@
 * Added support for setting text properties when adding text in content editor mode.
 * Added Flatten functionality.
 
-
 ## 1.11.1-dev.1
+
 * Added mode list configuration options.
 * Added `CPreviewMode.viewer` mode to view note annotation content
 
-
 ## 1.11.0
+
 * Added the features support for ComPDFKit PDF SDK for Android V1.11.0.
 * Added the features support for ComPDFKit PDF SDK for iOS V1.11.0.
 * Added the features of adding and deleting watermarks from one or a batch of PDF files.
@@ -20,10 +28,8 @@
 * Added support for digital signatures: Create, sign with, and verify digital certificates and digital signatures.
 * Added the feature configuration options.
 
-
 ## 1.0.0
 
 * Added `openDocument` method
 * ComPDFKit SDK for Android V1.9.1
 * ComPDFKit SDK for IOS V1.9.1
-

+ 30 - 46
README.md

@@ -6,8 +6,6 @@
 
 [ComPDFKit for Flutter](https://www.compdf.com/flutter) allows you to quickly add PDF functions to any Flutter application, elevating your Android and iOS apps to ensure seamless and efficient development.  It is available at [pub.dev](https://pub.dev/packages/compdfkit_flutter) and [GitHub.](https://github.com/ComPDFKit/compdfkit-pdf-sdk-flutter)
 
-
-
 ## Related
 
 * [ComPDFKit PDF Library for iOS](https://github.com/ComPDFKit/PDF-SDK-iOS)
@@ -18,27 +16,17 @@
 * [How to Use ComPDFKit Flutter SDK to Build a New Application](https://www.compdf.com/blog/use-compdfkit-flutter-sdk-to-build-new-app)
 * [ComPDFKit API](https://api.compdf.com/api/pricing) allows you to get 1000 files processing monthly now! Just [sign up](https://api.compdf.com/signup) for a free trial and enjoy comprehensive PDF functions.
 
-
-
-
 ## Key Features
 
 - [**Viewer**](https://www.compdf.com/pdf-sdk/viewer) component offers Standard page display modes, Navigation, Text search & selection, Zoom in and out & Fit-page, Text reflow, and more.
-
 - [**Annotations**](https://www.compdf.com/pdf-sdk/annotations) component offers Note, Link, Free Text, Line, Square, Circle, Highlight, Underline, Squiggly, Strikeout, Stamp, Ink, Sound, and more.
-
 - [**Forms**](https://www.compdf.com/pdf-sdk/forms) component offers Push Button, Check Box, Radio Button, Text Field, Combo Box, List Box, Signature, and more.
-
 - [**Document Editor**](https://www.compdf.com/pdf-sdk/document-editor) component offers Split, Extract, Merge, Delete, Insert, Crop, Move, Rotate, Replace, and Exchange pages, etc.
-
 - [**Content Editor**](https://www.compdf.com/pdf-sdk/edit-pdf) component offers Copy, Resize, Change Colors, Text Alignment, Find and Replace, etc.
-
 - [**Security**](https://www.compdf.com/pdf-sdk/security) component offers Encrypt and Decrypt PDFs, Watermark, etc.
 
 If you want to know all the features that ComPDFKit SDK can offer, please see our [Feature List](https://www.compdf.com/pdf-sdk/features-list).
 
-
-
 ## Get Started
 
 It's easy to embed [ComPDFKit Flutter SDK](https://www.compdf.com/guides/pdf-sdk/flutter/overview) into Flutter applications with a few lines of code. The following sections describe the optimal systems and environments to support, as well as quick integration steps. Let's take a few minutes to get started.
@@ -50,11 +38,8 @@ It's easy to embed [ComPDFKit Flutter SDK](https://www.compdf.com/guides/pdf-sdk
 Please install the following required packages:
 
 * The [latest stable version of Flutter](https://docs.flutter.dev/get-started/install)
-
 * The [latest stable version of Android Studio](https://developer.android.com/studio)
-
 * The [Android NDK](https://developer.android.com/studio/projects/install-ndk)
-
 * An [Android Virtual Device](https://developer.android.com/studio/run/managing-avds.html)
 
 Operating Environment Requirements:
@@ -64,15 +49,12 @@ Operating Environment Requirements:
 * A `targetSdkVersion` of `30` or higher.
 * Android ABI(s): x86, x86_64, armeabi-v7a, arm64-v8a.
 
-
 **iOS**
 
 Please install the following required packages:
 
 * The [latest stable version of Flutter](https://docs.flutter.dev/get-started/install)
-
 * The [latest stable version of Xcode](https://apps.apple.com/us/app/xcode/id497799835?mt=12)
-
 * The [latest stable version of CocoaPods](https://github.com/CocoaPods/CocoaPods/releases). Follow the [CocoaPods installation guide](https://guides.cocoapods.org/using/getting-started.html#installation) to install it.
 
 Operating Environment Requirements:
@@ -80,8 +62,6 @@ Operating Environment Requirements:
 * The iOS 10.0 or higher.
 * The Xcode 12.0 or newer for Objective-C or Swift.
 
-
-
 ### Integrate into a New Flutter APP
 
 #### Android
@@ -103,11 +83,16 @@ cd example
 ```diff
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.compdfkit.flutter.example">
-    
+  
     <!-- Required to read and write documents from device storage -->
 +    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
 +    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
++    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
 
+    <application
++      android:requestLegacyExternalStorage="true">
+  
+    </application>   
 </manifest>
 ```
 
@@ -135,7 +120,7 @@ open android/app/build.gradle
  dependencies:
    flutter:
      sdk: flutter
-+  compdfkit_flutter: ^1.12.0
++  compdfkit_flutter: ^1.13.0
 ```
 
 7. From the terminal app, run the following command to get all the packages:
@@ -175,8 +160,11 @@ class _MyAppState extends State<MyApp> {
   }
 
   void _init() async {
-    // Please replace it with your ComPDFKit license
-    ComPDFKit.init('your compdfkit key');
+    /// Please replace it with your ComPDFKit license
+    ComPDFKit.initialize('your compdfkit key');
+    
+    /// If you are using an offline certified license, please use the following method to initialize the SDK
+    /// ComPDFKit.initalize('your compdfkit key', offline : true)
   }
 
   @override
@@ -251,7 +239,6 @@ class _MyAppState extends State<MyApp> {
   ```bash
   mkdir pdfs
   ```
-
 * Copy your example document into the newly created `pdfs` directory and name it `PDF_Document.pdf`
 
 10. Specify the `assets` directory in `pubspec.yaml`
@@ -263,7 +250,6 @@ class _MyAppState extends State<MyApp> {
 ```
 
 11. Start your Android emulator, or connect a device.
-
 12. Run the app with:
 
 ```bash
@@ -290,7 +276,7 @@ cd example
  dependencies:
    flutter:
      sdk: flutter
-+  compdfkit_flutter: ^1.12.0
++  compdfkit_flutter: ^1.13.0
 ```
 
 4. From the terminal app, run the following command to get all the packages:
@@ -316,8 +302,8 @@ open ios/Podfile
    use_modular_headers!`
 
    flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
-+  pod 'ComPDFKit_Tools', podspec:'https://www.compdf.com/download/ios/cocoapods/xcframeworks/compdfkit_tools/1.12.0.podspec'
-+  pod 'ComPDFKit', podspec:'https://www.compdf.com/download/ios/cocoapods/xcframeworks/compdfkit/1.12.0.podspec'
++  pod 'ComPDFKit_Tools', podspec:'https://www.compdf.com/download/ios/cocoapods/xcframeworks/compdfkit_tools/1.13.0.podspec'
++  pod 'ComPDFKit', podspec:'https://www.compdf.com/download/ios/cocoapods/xcframeworks/compdfkit/1.13.0.podspec'
 
  end
 ```
@@ -359,8 +345,11 @@ class _MyAppState extends State<MyApp> {
   }
 
   void _init() async {
-    // Please replace it with your ComPDFKit license
-    ComPDFKit.init('your compdfkit key');
+    /// Please replace it with your ComPDFKit license
+    ComPDFKit.initialize('your compdfkit key');
+    
+    /// If you are using an offline certified license, please use the following method to initialize the SDK
+    /// ComPDFKit.initalize('your compdfkit key', offline : true)
   }
 
   @override
@@ -432,7 +421,6 @@ class _MyAppState extends State<MyApp> {
   ```bash
   mkdir pdfs
   ```
-
 * Copy your example document into the newly created `pdfs` directory and name it `PDF_Document.pdf`
 
 10. Specify the `assets` directory in `pubspec.yaml`
@@ -473,8 +461,6 @@ flutter emulators --launch apple_ios_simulator
 flutter run
 ```
 
-
-
 ## UI Customization
 
 In version **1.12.0**, we have expanded the options that can be defined in the [CPDFConfiguration](./lib/cpdf_configuration.dart) class. When using the `ComPDFKit.openDocument` method to open a PDF View, you can define this object to meet your product requirements. We will continue to enrich configuration options in the future to further enhance the flexibility of the product. Here are some examples of commonly used configuration options:
@@ -519,8 +505,6 @@ ComPDFKit.openDocument(documentPath, password: '', configuration: configuration)
 
 > Note: For more information, please refer to the options defined in the [CPDFConfiguration](./lib/cpdf_configuration.dart) class
 
-
-
 ## Example APP
 
 To see [ComPDFKit for Flutter](https://www.compdf.com/contact-sales) in action, check out our [Flutter example app](example/) and [API reference](https://pub.dev/documentation/compdfkit_flutter/latest/compdfkit/compdfkit-library.html)
@@ -528,15 +512,19 @@ To see [ComPDFKit for Flutter](https://www.compdf.com/contact-sales) in action,
 Showing a PDF document inside your Flutter app is as simple as this:
 
 ```dart
-// First. Please replace it with your ComPDFKit license
-ComPDFKit.init('your compdfkit key')
+/// First. Please replace it with your ComPDFKit license
+/// If your ComPDFKit License is an offline key, please set online: false.
+
+/// online authentication
+ComPDFKit.initialize('your compdfkit key');
+
+/// offline authentication
+ComPDFKit.initialize('your compdfkit key', offline: true);
   
-// open pdf document
+/// open pdf document
 ComPDFKit.openDocument(tempDocumentPath, password: '', configuration:  CPDFConfiguration());
 ```
 
-
-
 ## Support
 
 [ComPDFKit](https://www.compdf.com/) has a professional R&D team that produces comprehensive technical documentation and guides to help developers. Also, you can get an immediate response when reporting your problems to our support team.
@@ -546,17 +534,13 @@ ComPDFKit.openDocument(tempDocumentPath, password: '', configuration:  CPDFConfi
 - For technical assistance, please reach out to our [Technical Support](https://www.compdf.com/support).
 - To get more details and an accurate quote, please contact our [Sales Team](https://compdf.com/contact-us).
 
-
-
 ## License
 
 ComPDFKit PDF SDK supports flexible licensing options, please contact [our sales team](mailto:support@compdf.com) to know more. Each license is only valid for one application ID in development mode. However, any documents, sample code, or source code distribution from the released package of ComPDFKit PDF SDK to any third party is prohibited.
 
-
-
 ## Note
 
 We are glad to announce that you can register a ComPDFKit API account for a [free trial](https://api.compdf.com/api/pricing) to process 1000 documents per month for free.
 
 Thanks,
-The ComPDFKit Team
+The ComPDFKit Team

+ 3 - 3
android/build.gradle

@@ -41,9 +41,9 @@ android {
         implementation 'com.google.android.material:material:1.8.0'
         implementation 'androidx.appcompat:appcompat:1.6.1'
         implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
-        api 'com.compdf:compdfkit:1.12.0'
-        api 'com.compdf:compdfkit-ui:1.12.0'
-        api 'com.compdf:compdfkit-tools:1.12.0'
+//        api 'com.compdf:compdfkit:1.13.0'
+//        api 'com.compdf:compdfkit-ui:1.12.0'
+        api 'com.compdf:compdfkit-tools:1.13.0-SNAPSHOT'
         testImplementation 'junit:junit:4.13.2'
         testImplementation 'org.mockito:mockito-core:5.0.0'
         api 'com.github.bumptech.glide:glide:4.15.1'

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

@@ -47,7 +47,8 @@ public class ComPDFKitSDKPlugin extends BaseMethodChannelPlugin {
             case INIT_SDK:
                 Map<String, Object> map = (Map<String, Object>) call.arguments;
                 String key = (String) map.get("key");
-                CPDFSdk.init(context, key);
+                boolean offlineAuth = (boolean) map.get("offline");
+                CPDFSdk.init(context, key, offlineAuth);
                 break;
             case SDK_VERSION_CODE:
                 result.success(CPDFSdk.getSDKVersion());

+ 1 - 1
example/android/app/build.gradle

@@ -55,7 +55,7 @@ android {
         applicationId "com.compdfkit.flutter.example"
         minSdkVersion 21
         targetSdkVersion 33
-        versionCode flutterVersionCode.toInteger()
+        versionCode 4
         versionName flutterVersionName
     }
 

File diff suppressed because it is too large
+ 4 - 5
example/lib/main.dart


+ 7 - 7
example/pubspec.lock

@@ -47,15 +47,15 @@ packages:
       path: ".."
       relative: true
     source: path
-    version: "1.12.0"
+    version: "1.13.0"
   cupertino_icons:
     dependency: "direct main"
     description:
       name: cupertino_icons
-      sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be
+      sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
       url: "https://pub.dev"
     source: hosted
-    version: "1.0.5"
+    version: "1.0.6"
   fake_async:
     dependency: transitive
     description:
@@ -86,10 +86,10 @@ packages:
     dependency: "direct dev"
     description:
       name: flutter_lints
-      sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4"
+      sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
       url: "https://pub.dev"
     source: hosted
-    version: "2.0.2"
+    version: "2.0.3"
   flutter_test:
     dependency: "direct dev"
     description: flutter
@@ -157,10 +157,10 @@ packages:
     dependency: transitive
     description:
       name: plugin_platform_interface
-      sha256: "43798d895c929056255600343db8f049921cbec94d31ec87f1dc5c16c01935dd"
+      sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
       url: "https://pub.dev"
     source: hosted
-    version: "2.1.5"
+    version: "2.1.8"
   process:
     dependency: transitive
     description:

+ 1 - 1
example/pubspec.yaml

@@ -1,6 +1,6 @@
 name: compdfkit_flutter_example
 description: Demonstrates how to use the compdfkit_flutter plugin.
-version: 1.12.0
+version: 1.13.0
 homepage: https://www.compdf.com
 repository: https://github.com/ComPDFKit/compdfkit-pdf-sdk-flutter
 issue_tracker: https://www.compdf.com/support

+ 29 - 5
lib/compdfkit.dart

@@ -19,16 +19,40 @@ class ComPDFKit {
   static const sdkBuildTag = "sdk_build_tag";
 
   /// Please enter your ComPDFKit license to initialize the ComPDFKit SDK.<br/>
-  /// A new license verification is enabled in ComPDFKit SDK V1.11.0.
-  /// If you want to update the ComPDFKit SDK to V1.11.0 and do not have a new license,
-  /// please contact the [ComPDFKit team.](https://www.compdf.com/support)"
+  /// In version **1.13.0**, we have introduced a brand-new online authentication licensing scheme.
+  /// By default, the ComPDFKit SDK performs online authentication.
+  /// If you obtained your ComPDFKit License before the release of version 1.13.0, please set [offline=true].<br/>
+  /// If you are unsure about the type of your license, please contact the [ComPDFKit team.](https://www.compdf.com/support).
   ///
-  /// **samples:**
+  /// **samples:**<br/>
   /// ```dart
   /// ComPDFKit.init('your compdfkit license')
   /// ```
+  @Deprecated('in 1.13.0 deprecated, please use initialize(String key, {bool offline = true})')
   static void init(String key) async {
-    _methodChannel.invokeMethod(initSDK, {'key': key});
+    _methodChannel.invokeMethod(initSDK, {'key': key, 'online': false});
+  }
+
+  /// Please enter your ComPDFKit license to initialize the ComPDFKit SDK.<br/>
+  /// In version **1.13.0**, we have introduced a brand-new online authentication licensing scheme.
+  /// By default, the ComPDFKit SDK performs online authentication.
+  /// If you obtained your ComPDFKit License before the release of version 1.13.0, please set [offline=true].
+  /// or use ComPDFKit.init(String key) <br/>
+  /// If you are unsure about the type of your license, please contact the [ComPDFKit team.](https://www.compdf.com/support).
+  ///
+  /// **samples:**<br/>
+  /// **online auth**
+  /// ```dart
+  /// ComPDFKit.initialize('your compdfkit license')
+  /// ```
+  ///
+  /// <br/>
+  /// **offline auth**
+  /// ```dart
+  /// ComPDFKit.initialize('your compdfkit license', offline = true)
+  /// ```
+  static void initialize(String key, {bool offline = false}) {
+    _methodChannel.invokeMethod(initSDK, {'key': key, 'offline': offline});
   }
 
   /// Get the version code of the ComPDFKit SDK.

+ 4 - 4
pubspec.lock

@@ -58,10 +58,10 @@ packages:
     dependency: "direct dev"
     description:
       name: flutter_lints
-      sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4"
+      sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
       url: "https://pub.dev"
     source: hosted
-    version: "2.0.2"
+    version: "2.0.3"
   flutter_test:
     dependency: "direct dev"
     description: flutter
@@ -111,10 +111,10 @@ packages:
     dependency: "direct main"
     description:
       name: plugin_platform_interface
-      sha256: "43798d895c929056255600343db8f049921cbec94d31ec87f1dc5c16c01935dd"
+      sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
       url: "https://pub.dev"
     source: hosted
-    version: "2.1.5"
+    version: "2.1.8"
   sky_engine:
     dependency: transitive
     description: flutter

+ 1 - 1
pubspec.yaml

@@ -1,6 +1,6 @@
 name: compdfkit_flutter
 description: ComPDFKit for Flutter is a comprehensive SDK that allows you to quickly add PDF functionality to Android and iOS Flutter applications.
-version: 1.12.0
+version: 1.13.0
 homepage: https://www.compdf.com
 repository: https://github.com/ComPDFKit/compdfkit-pdf-sdk-flutter
 issue_tracker: https://www.compdf.com/support