|
@@ -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());
|
|
|
```
|