Browse Source

ComPDFKit(flutter) - compdfkit_flutter 1.13.0 release

liuxiaolong 9 months ago
parent
commit
0e34bfbd70

+ 7 - 0
CHANGELOG.md

@@ -1,3 +1,10 @@
+## 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 support for online license verification function. 
+* Added `ComPDFKit.initialize(androidOnlineLicense : String, iosOnlineLicense : String)` method.
+
 ## 1.13.0-dev.1
 
 * Added the features support for ComPDFKit PDF SDK for iOS V1.13.0-beta.

+ 95 - 13
README.md

@@ -124,7 +124,7 @@ open android/app/build.gradle
  dependencies:
    flutter:
      sdk: flutter
-+  compdfkit_flutter: ^1.13.0-dev.1
++  compdfkit_flutter: ^1.13.0
 ```
 
 7. From the terminal app, run the following command to get all the packages:
@@ -165,10 +165,10 @@ class _MyAppState extends State<MyApp> {
 
   void _init() async {
     /// Please replace it with your ComPDFKit license
-    ComPDFKit.initialize('your compdfkit key');
+    ComPDFKit.initialize(androidOnlineLicense : 'your compdfkit key', iosOnlineLicense : '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)
+    /// If you are using an offline certified license, please use init() method
+    /// ComPDFKit.init('your compdfkit key')
   }
 
   @override
@@ -280,7 +280,7 @@ cd example
  dependencies:
    flutter:
      sdk: flutter
-+  compdfkit_flutter: ^1.13.0-dve.1
++  compdfkit_flutter: ^1.13.0
 ```
 
 4. From the terminal app, run the following command to get all the packages:
@@ -295,6 +295,8 @@ flutter pub get
 open ios/Podfile
 ```
 
+**Note:** If SSL network requests fail to download the `ComPDFKit` library when you run `pod install`, you can see the processing method in [Troubleshooting](#Troubleshooting)).
+
 6. Update the platform to iOS 11 and add the ComPDFKit Podspec:
 
 ```diff
@@ -307,7 +309,8 @@ open ios/Podfile
    use_modular_headers!`
 
    flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
-+  pod 'ComPDFKit', :git => 'https://github.com/ComPDFKit/compdfkit-ios.git', :tag => '1.13.0'
++  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
 ```
@@ -350,10 +353,10 @@ class _MyAppState extends State<MyApp> {
 
   void _init() async {
     /// Please replace it with your ComPDFKit license
-    ComPDFKit.initialize('your compdfkit key');
+    ComPDFKit.initialize(androidOnlineLicense : 'your compdfkit key', iosOnlineLicense : '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)
+    /// If you are using an offline certified license, please use init() method
+    /// ComPDFKit.init('your compdfkit key')
   }
 
   @override
@@ -451,6 +454,12 @@ class _MyAppState extends State<MyApp> {
 
 <key>NSPhotoLibraryUsageDescription</key>
 <string>Your consent is required before you could access the function.</string>
+  
+<key>NSAppTransportSecurity</key>
+	<dict>
+		<key>NSAllowsArbitraryLoads</key>
+		<true/>
+	</dict>
 ```
 
 12. Start your Android emulator, or connect a device.
@@ -465,6 +474,80 @@ flutter emulators --launch apple_ios_simulator
 flutter run
 ```
 
+
+
+#### Apply the License Key
+
+ComPDFKit PDF SDK is a commercial SDK, which requires a license to grant developer permission to release their apps. Each license is only valid for one `bundle ID` or `applicationId` in development mode. Other flexible licensing options are also supported, please contact [our marketing team](mailto:support@compdf.com) to know more.
+
+To initialize ComPDFKit using a license key, call either of the following before using any other ComPDFKit APIs or features:
+
+* **Online license:**
+
+```dart
+ComPDFKit.initialize(androidOnlineLicense : 'your compdfkit key', iosOnlineLicense : 'your compdfkit key');
+```
+
+* **Offline license:**
+
+```dart
+ComPDFKit.init('your compdfkit key');
+```
+
+
+
+#### Troubleshooting
+
+1.SSL network request to download 'ComPDFKit' library failed when cocopods downloaded iOS third-party library
+
+If SSL network requests fail to download the `ComPDFKit` library when you run `pod install`, replace the third-party platform download address link of the ComPDFKit library and execute `pod install`
+
+````diff
+require_relative '../node_modules/react-native/scripts/react_native_pods'
+require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
+
+- platform :ios, '10.0'
++ platform :ios, '11.0'
+install! 'cocoapods', :deterministic_uuids => false
+
+target 'PDFView_RN' do
+  config = use_native_modules!
+
+  # Flags change depending on the env values.
+  flags = get_default_flags()
+
+  use_react_native!(
+    :path => config[:reactNativePath],
+    # to enable hermes on iOS, change `false` to `true` and then install pods
+    :hermes_enabled => flags[:hermes_enabled],
+    :fabric_enabled => flags[:fabric_enabled],
+    # An absolute path to your application root.
+    :app_path => "#{Pod::Config.instance.installation_root}/.."
+  )
+
+  target 'PDFView_RNTests' do
+    inherit! :complete
+    # Pods for testing
+  end
+
++  pod 'ComPDFKit', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '1.13.0'
++  pod 'ComPDFKit_Tools', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '1.13.0'
+
+  # Enables Flipper.
+  #
+  # Note that if you have use_frameworks! enabled, Flipper will not work and
+  # you should disable the next line.
+  use_flipper!()
+
+  post_install do |installer|
+    react_native_post_install(installer)
+    __apply_Xcode_12_5_M1_post_install_workaround(installer)
+  end
+end
+````
+
+
+
 ## 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:
@@ -517,14 +600,13 @@ Showing a PDF document inside your Flutter app is as simple as this:
 
 ```dart
 /// 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');
+ComPDFKit.initialize(androidOnlineLicense : 'your compdfkit key', iosOnlineLicense : 'your compdfkit key');
 
 /// offline authentication
-ComPDFKit.initialize('your compdfkit key', offline: true);
-  
+ComPDFKit.init('your compdfkit key')
+
 /// open pdf document
 ComPDFKit.openDocument(tempDocumentPath, password: '', configuration:  CPDFConfiguration());
 ```

+ 4 - 3
android/build.gradle

@@ -41,9 +41,10 @@ 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.13.0-SNAPSHOT'
-        api 'com.compdf:compdfkit-ui:1.13.0-SNAPSHOT'
-        api ('com.compdf:compdfkit-tools:1.13.0-SNAPSHOT')
+        api 'com.compdf:compdfkit:1.13.0'
+        api 'com.compdf:compdfkit-ui:1.13.0'
+        api ('com.compdf:compdfkit-tools:1.13.0')
+
         testImplementation 'junit:junit:4.13.2'
         testImplementation 'org.mockito:mockito-core:5.0.0'
         api 'com.github.bumptech.glide:glide:4.15.1'

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

@@ -33,6 +33,8 @@ public class ComPDFKitSDKPlugin extends BaseMethodChannelPlugin {
 
     public static final String INIT_SDK = "init_sdk";
 
+    public static final String INIT_SDK_KEYS = "init_sdk_keys";
+
     public static final String SDK_VERSION_CODE = "sdk_version_code";
 
     public static final String SDK_BUILD_TAG = "sdk_build_tag";
@@ -47,8 +49,12 @@ public class ComPDFKitSDKPlugin extends BaseMethodChannelPlugin {
             case INIT_SDK:
                 Map<String, Object> map = (Map<String, Object>) call.arguments;
                 String key = (String) map.get("key");
-                boolean offlineAuth = (boolean) map.get("offline");
-                CPDFSdk.init(context, key, offlineAuth);
+                CPDFSdk.init(context, key, true);
+                break;
+            case INIT_SDK_KEYS:
+                Map<String, Object> map1 = (Map<String, Object>) call.arguments;
+                String androidLicenseKey = (String) map1.get("androidOnlineLicense");
+                CPDFSdk.init(context, androidLicenseKey, false);
                 break;
             case SDK_VERSION_CODE:
                 result.success(CPDFSdk.getSDKVersion());

+ 1 - 1
example/ios/Podfile

@@ -1,5 +1,5 @@
 # Uncomment this line to define a global platform for your project
-# platform :ios, '11.0'
+# platform :ios, '12.0'
 
 # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
 ENV['COCOAPODS_DISABLE_STATS'] = 'true'

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


+ 1 - 1
example/pubspec.lock

@@ -47,7 +47,7 @@ packages:
       path: ".."
       relative: true
     source: path
-    version: "1.13.0-dev.1"
+    version: "1.13.0"
   cupertino_icons:
     dependency: "direct main"
     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.13.0-dev.1
+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

+ 6 - 7
ios/Classes/CompdfkitFlutterPlugin.swift

@@ -17,13 +17,12 @@ public class CompdfkitFlutterPlugin: NSObject, FlutterPlugin, CPDFViewBaseContro
         case "init_sdk":
             let initInfo = call.arguments as? [String: Any]
             let key = initInfo?["key"] ?? ""
-            let offlineAuth = initInfo?["offline"] as? Bool ?? false
-            if(offlineAuth){
-                CPDFKit.verify(withKey: key as? String)
-            }else {
-              CPDFKit.verify(withOnlineLicense: key as? String) { code, message in
-                    print("Code: \(code), Message:\(String(describing: message))")
-              }
+            CPDFKit.verify(withKey: key as? String)
+        case "init_sdk_keys":
+            let initInfo = call.arguments as? [String: Any]
+            let key = initInfo?["iosOnlineLicense"] ?? ""
+            CPDFKit.verify(withOnlineLicense: key as? String) { code, message in
+                print("Code: \(code), Message:\(String(describing: message))")
             }
         case "sdk_build_tag":
             result("iOS build tag:\(CPDFKit.sharedInstance().buildNumber)")

+ 8 - 15
lib/compdfkit.dart

@@ -15,45 +15,38 @@ class ComPDFKit {
       MethodChannel('com.compdfkit.flutter.plugin');
 
   static const initSDK = 'init_sdk';
+  static const initSdkKeys = 'init_sdk_keys';
   static const sdkVersionCode = 'sdk_version_code';
   static const sdkBuildTag = "sdk_build_tag";
 
   /// Please enter your ComPDFKit license to initialize the ComPDFKit SDK.<br/>
+  /// This method is used for offline license authentication.
   /// 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:**<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, 'online': false});
+    _methodChannel.invokeMethod(initSDK, {'key': key});
   }
 
   /// Please enter your ComPDFKit license to initialize the ComPDFKit SDK.<br/>
+  /// This method is used for online license authentication
   /// 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 obtained your ComPDFKit License before the release of version 1.13.0, please use [ComPDFKit.init] <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')
+  /// ComPDFKit.initialize(androidOnlineLicense : 'your android platform compdfkit license', iosOnlineLicense: 'your ios platform 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});
+  static void initialize({required String androidOnlineLicense,required String iosOnlineLicense}) {
+    _methodChannel.invokeMethod(initSdkKeys, {'androidOnlineLicense': androidOnlineLicense, 'iosOnlineLicense': iosOnlineLicense});
   }
 
   /// Get the version code of the ComPDFKit SDK.

+ 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.13.0-dev.1
+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