Kaynağa Gözat

compdfkit(rn) - README.md 文档

liuxiaolong 7 ay önce
ebeveyn
işleme
81732f173f

+ 524 - 13
README.md

@@ -1,31 +1,542 @@
-# react-native-compdfkit-pdf
+# ComPDFKit React-Native PDF Library
+
+
+
+## Overview
+
+ComPDFKit for React Native is a comprehensive SDK that allows you to quickly add PDF fuctions to any React Native application, such as viewer, annotations, editing PDFs, forms and signatures.
+
+More information can be found at [https://www.compdf.com/](https://www.compdf.com/)
+
+
+
+## API
+
+APIs are available on the [API](API.md)
+
+
+
+## Prerequisites
+
+* A license is required for trial. Please contact our [sales team](https://www.compdf.com/contact-sales) to obtain a free trial license.
+* npm or yarn
+* ComPDFKit SDK => 2.0.1
+* react-native => 0.60.0
+
 
-ComPDFKit for React Native
 
 ## Installation
 
-```sh
-npm install react-native-compdfkit-pdf
+First, please follow the official [React Native environment setup guide](https://reactnative.dev/docs/environment-setup), configure [iOS and Android environments](https://reactnative.dev/docs/environment-setup), and create a [React Native project](https://reactnative.dev/docs/environment-setup). If you have already created a React Native project, you can skip directly to [Integrate](https://chat.openai.com/c/08073ca6-930d-42b5-904a-d2ec8fadb6f6#Integrate).
+
+### Creating a New Project
+
+Let's create a simple app that integrates ComPDFKit for React Native.
+
+1. In the terminal app, change the current working directory to the location you wish to save your project. In this example, we’ll use the `~/Documents/` directory:
+
+   ```bash
+   cd ~/Documents
+   ```
+
+2. Create the React Native project by running the following command:
+
+   ```bash
+   react-native init MyApp
+   ```
+
+3. In the terminal app, change the location of the current working directory inside the newly created project:
+
+   ```bash
+   cd MyApp
+   ```
+
+### Integrate
+
+You can integrate the SDK in two ways:
+
+* **Through ComPDFKit GitHub repo:**
+
+  In `MyApp` folder, install `react-native-compdfkit-pdf` by calling:
+
+  ```shell
+  npm add github:ComPDFKit/react-native-compdfkit-pdf
+  yarn install
+  ```
+
+  or 
+
+  ```shell
+  npm install github:ComPDFKit/react-native-compdfkit-pdf --save
+  npm install
+  ```
+
+* **Through ComPDFKit npm package:**
+
+  In `MyApp` folder, install run the following commands:
+
+  ```
+  npm install react-native-compdfkit-pdf
+  ```
+
+
+#### Android
+
+1. open  `android/app/src/main/AndroidManifest.xml` , add  `Internet Permission` and `Storage Permission`:
+
+```diff
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.compdfkit.flutter.example">
+
++    <uses-permission android:name="android.permission.INTERNET"/>
+  
+    <!-- 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"/>
+
+		<!-- Optional settings -->
++    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
+
+    <application
++    android:requestLegacyExternalStorage="true"
+        ...>
+	...
+    </application>
+</manifest>
+```
+
+2. Copy the sample pdf file to the `assets` directory
+
+<img src="./screenshots/demo-android-2.png" alt="demo-android-2" style="zoom:33%;" />
+
+2. Replace `App.js` (or `App.tsx`) with what is shown for [NPM](https://www.npmjs.com/package/@pdftron/react-native-pdf?activeTab=readme#Usage-NPM) or [GitHub](https://www.npmjs.com/package/@pdftron/react-native-pdf?activeTab=readme#Usage-Github)
+
+3. Finally in the root project directory, run `react-native run-android`.
+
+
+
+#### iOS
+
+1. Open your project’s Podfile in a text editor:
+
+```bash
+open ios/Podfile
+```
+
+2. add the following line to the `target 'MyApp' do ... end` block:
+
+```diff
+target 'MyApp' do
+    # ...
++    pod "ComPDFKit", podspec:'https://www.compdf.com/download/ios/cocoapods/xcframeworks/compdfkit/2.0.1.podspec'
++  pod "ComPDFKit_Tools", podspec:'https://www.compdf.com/download/ios/cocoapods/xcframeworks/compdfkit_tools/2.0.1.podspec'
+    # ...
+end
+```
+
+**Note:** If SSL network requests fail to download the `ComPDFKit` library when you run `pod install`, <font color=red>您可以替换为以下链接   (,,, 这里看要不要更详细一点, NPM , github 文档不想写太长,想官网文档里写详细一点)</font>
+
+```diff
+target 'MyApp' do
+    # ...
++  pod 'ComPDFKit', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '2.0.1'
++  pod 'ComPDFKit_Tools', :git => 'https://github.com/ComPDFKit/compdfkit-pdf-sdk-ios-swift.git', :tag => '2.0.1'
+    # ...
+end
+```
+
+3. In the `ios` folder, run `pod install`.
+
+4. Open your project’s Workspace in Xcode:
+
+   ```bash
+   open ios/PDFView_RN.xcworkspace
+   ```
+
+   Make sure the deployment target is set to 10.0 or higher:
+
+   ![1-1](./screenshots/1-1.png)
+
+5. <font color=red>Add the PDF document you want to display to your application by dragging it into your project. On the dialog that’s displayed, select Finish to accept the default integration options. You can use "developer_guide_ios.pdf" as an example. 下面重新换张图, 示例文件名称换为PDF_Document.pdf</font>
+
+   <img src="./screenshots/1-7.png" style="zoom:50%;" />
+
+```
+<key>NSCameraUsageDescription</key>
+<string>Your consent is required before you could access the function.</string>
+
+<key>NSMicrophoneUsageDescription</key>
+<string>Your consent is required before you could access the function.</string>
+
+<key>NSPhotoLibraryAddUsageDescription</key>
+<string>Your consent is required before you could access the function.</string>
+
+<key>NSPhotoLibraryUsageDescription</key>
+<string>Your consent is required before you could access the function.</string>
+  
+<key>NSAppTransportSecurity</key>
+	<dict>
+		<key>NSAllowsArbitraryLoads</key>
+		<true/>
+	</dict>
 ```
 
+3. Replace `App.js` (or `App.tsx`) with what is shown for [NPM](https://www.npmjs.com/package/@pdftron/react-native-pdf?activeTab=readme#Usage-NPM) or [GitHub](https://www.npmjs.com/package/@pdftron/react-native-pdf?activeTab=readme#Usage-Github)
+
+4. Finally in the root project directory, run `react-native run-ios`.
+
+
+
 ## Usage
 
-```js
-import { multiply } from 'react-native-compdfkit-pdf';
+### Apply the License Key
+
+ComPDFKit for React Native 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 certification
+
+```tsx
+import { ComPDFKit } from 'react-native-compdfkit-pdf';
+
+type Props = {};
+export default class App extends Component<Props> {
+	...
+  
+  componentDidMount(){
+    // Fill in your online license
+    ComPDFKit.initialize('your android platform compdfkit license', 'your ios platform compdfkit license')
+  }
+  // ...
+}
+```
+
+* Offline authentication
+
+```tsx
+import { ComPDFKit } from 'react-native-compdfkit-pdf';
+
+type Props = {};
+export default class App extends Component<Props> {
+	...
+  
+  componentDidMount(){
+    // Fill in your offline license
+    ComPDFKit.init_('your compdfkit license')
+  }
+  // ...
+}
+```
+
+### Usage Example
+
+After installing from NPM or GitHub, replace `App.tsx` with the following code.
 
-// ...
+Make sure to follow the above steps to copy the sample document into your Android or iOS project.
 
-const result = await multiply(3, 7);
+The example includes a usage demonstration of selecting a PDF document from local file storage, which requires the use of the [react-native-document-picker](https://www.npmjs.com/package/react-native-document-picker) package. You can add this package as follows or remove the `pickPDFFile` function code from the example:
+
+```shell
+npm i react-native-document-picker
+```
+
+Here is the sample code for `App.tsx`:
+
+```tsx
+/**
+ * Copyright © 2014-2024 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.
+ * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
+ * This notice may not be removed from this file.
+ */
+
+ import React, { Component } from 'react';
+ import DocumentPicker from 'react-native-document-picker'
+ import {
+   StyleSheet,
+   Text,
+   View,
+   TouchableOpacity,
+   SafeAreaView
+ } from 'react-native';
+ import { ComPDFKit } from 'react-native-compdfkit-pdf';
+ import { Platform } from 'react-native';
+ 
+ type Props = {};
+ 
+ export default class App extends Component<Props> {
+ 
+   state = {
+     versionCode: ''
+   }
+ 
+   constructor(props: Props) {
+     super(props)
+     this.initialize()
+     this.getVersionCode()
+   }
+ 
+   async getVersionCode() {
+     // Get the version code of ComPDFKit SDK
+     var version = await ComPDFKit.getVersionCode()
+     this.setState({
+       versionCode: version
+     })
+   }
+ 
+   async initialize() {
+     // Online certification, Fill in your online license
+     // Returns true if initialization is successful, otherwise returns false.
+     var result = await ComPDFKit.initialize('compdfkit android license', 'compdfkit ios license')
+     console.log("ComPDFKitRN", "initialize:", result)
+ 
+     // Offline authentication, Fill in your offline license
+     // var result = await ComPDFKit.init_('your compdfkit license')
+     // console.log("ComPDFKitRN", "init_:", result)
+   }
+ 
+   /**
+    * Open the sample document embedded in Android or iOS project.
+    */
+   openSample(){
+     var samplePDF: string = Platform.OS == 'android' ? 'file:///android_asset/PDF_Document.pdf' : 'PDF_Document.pdf'
+     // We provide default UI and PDF property related configurations here, you can modify configuration options according to your needs.
+     var config = ComPDFKit.getDefaultConfig({
+ 
+     })
+     ComPDFKit.openDocument(samplePDF, '', config)
+   }
+ 
+   /**
+    * Pick a PDF file from the local storage of Android or iOS device, this example uses the `react-native-document-picker` package,
+    * If you want to use this example, please add this package to your project first.
+    * {@link https://www.npmjs.com/package/react-native-document-picker}
+    * 
+    */
+   pickPDFFile(){
+     try {
+       const pickerResult = DocumentPicker.pick({
+         type: [DocumentPicker.types.pdf]
+       });
+       pickerResult.then(res => {
+         ComPDFKit.openDocument(res[0]?.uri as string, '', ComPDFKit.getDefaultConfig({}))
+       })
+     } catch (err) {
+     }
+   }
+ 
+   render() {
+     return (
+       <SafeAreaView style={{ flex: 1 }}>
+         <View style={styles.scaffold}>
+           <View style={styles.appBar}>
+             <Text style={styles.mediumTitle}>
+               ComPDFKit PDF SDK for ReactNative
+             </Text>
+           </View>
+           <View style={styles.container}>
+             <TouchableOpacity onPress={() => {
+               this.openSample()
+             }}>
+               <View style={styles.funItem}>
+                 <Text style={{ fontWeight: 'bold' }}>{'Open Sample'}</Text>
+               </View>
+             </TouchableOpacity>
+ 
+             <View style={styles.dividingLine} />
+ 
+             <TouchableOpacity onPress={() => {
+               this.pickPDFFile()
+             }}>
+               <View style={styles.funItem}>
+                 <Text style={{ fontWeight: 'bold' }}>{'Pick Document'}</Text>
+               </View>
+               <View style={styles.dividingLine} />
+ 
+             </TouchableOpacity>
+ 
+             <View style={styles.buttom}>
+               <Text style={styles.body2}>ComPDFKit for {Platform.OS == 'android' ? 'Android' : 'iOS'} {this.state.versionCode}</Text>
+             </View>
+           </View>
+         </View>
+       </SafeAreaView>
+ 
+     );
+   }
+ }
+ 
+ const styles = StyleSheet.create({
+   appBar: {
+     height: 56,
+     backgroundColor: '#FAFCFF',
+     elevation: 4,
+     flexDirection: "row",
+     justifyContent: "space-between",
+     alignItems: "center",
+     padding: 16
+   },
+   mediumTitle: {
+     fontSize: 16,
+   },
+   body2: {
+     textAlign: 'center',
+     fontSize: 12
+   },
+   scaffold: {
+     flex: 1,
+   },
+   container: {
+     marginHorizontal: 16,
+     marginVertical: 8,
+     flex: 1,
+     // backgroundColor: '#F5FCFF',
+   },
+   funItem: {
+     height: 56,
+     justifyContent: 'center',
+     textAlign: 'center'
+   },
+   dividingLine: {
+     height: 0.5, backgroundColor: '#4D333333', width: '100%'
+   },
+   buttom: {
+     flex: 1,
+     justifyContent: 'flex-end',
+   }
+ });
+```
+
+* (Android) For local storage file path:
+
+```tsx
+document = 'file:///storage/emulated/0/Download/sample.pdf'
+```
+
+* (Android) For content Uri:
+
+```tsx
+document = 'content://...'
+```
+
+* (Android) For assets path:
+
+```tsx
+document = "file:///android_asset/..."
+```
+
+* (iOS) For app bundle file path:
+
+```tsx
+document = "document.pdf"
+```
+
+* <font color=red>(iOS) for URL path:  这里这样写对不对</font> 
+
+```tsx
+document = "file://xxxx/document.pdf"
+```
+
+
+
+### Configuration
+
+When rendering a PDF view using the `ComPDFKit.openDocument` method, you have the flexibility to enable or disable certain features or adjust default attribute values for PDF annotations, forms, and more through the `CPDFConfiguration` settings.
+
+For your convenience, you can obtain default attribute values by using the `ComPDFKit.getDefaultConfig({})` method.
+
+The following example demonstrates the configuration settings for some aspects. For more detailed configuration options, refer to [CONFIGURATION](./CONFIGURATION.md) for further information.
+
+1. Set the initial display mode and the list of available modes. The following code shows enabling only the viewer mode and annotations mode:
+
+```tsx
+import { ComPDFKit, CPDFViewMode } from 'react-native-compdfkit-pdf';
+
+var config = ComPDFKit.getDefaultConfig({
+  modeConfig:{
+    initialViewMode: CPDFViewMode.VIEWER,
+    availableViewModes: [
+      CPDFViewMode.VIEWER,
+      CPDFViewMode.ANNOTATIONS
+    ]
+  }
+})
+ComPDFKit.openDocument(samplePDF, '', config)
+```
+
+2. Set the list of enabled annotation types and default annotation attribute values. For example, enable only highlight annotations and set the color and transparency for highlight annotations:
+
+```tsx
+import { ComPDFKit, CPDFAnnotationType, CPDFConfigTool } from 'react-native-compdfkit-pdf';
+
+var config = ComPDFKit.getDefaultConfig({
+  annotationsConfig: {
+    availableType: [
+      CPDFAnnotationType.NOTE
+    ],
+    availableTools: [
+      CPDFConfigTool.SETTING,
+      CPDFConfigTool.UNDO,
+      CPDFConfigTool.REDO,
+    ],
+    initAttribute: {
+      note: {
+        color: '#1460F3',
+        alpha: 255
+      }
+    }
+  }
+})
+ComPDFKit.openDocument(samplePDF, '', config)
+```
+
+3. Set the display mode and page flipping direction:
+
+```tsx
+import { ComPDFKit, CPDFDisplayMode } from 'react-native-compdfkit-pdf';
+
+var config = ComPDFKit.getDefaultConfig({
+  readerViewConfig: {
+    displayMode: CPDFDisplayMode.DOUBLE_PAGE,
+    verticalMode: false
+  }
+})
+ComPDFKit.openDocument(samplePDF, '', config)
 ```
 
-## Contributing
 
-See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
 
 ## License
 
-MIT
+See [License](./LICENSE)
+
+
+
+## Support
+
+### Reporting Problems
+
+Thank you for your interest in ComPDFKit PDF SDK, the only easy-to-use but powerful development solution to integrate high quality PDF rendering capabilities to your applications. If you encounter any technical questions or bug issues when using ComPDFKit PDF SDK for React Native, please submit the problem report to the ComPDFKit team. More information as follows would help us to solve your problem:
+
+- ComPDFKit PDF SDK product and version.
+- Your operating system and IDE version.
+- Detailed descriptions of the problem.
+- Any other related information, such as an error screenshot.
+
+
+
+## Contact Information
+
+**Home Link:**
+
+[https://www.compdf.com](https://www.compdf.com)
+
+**Support & General Contact:**
 
----
+Email: support@compdf.com
 
-Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
+Thanks,
+The ComPDFKit Team

+ 0 - 1
example/.watchmanconfig

@@ -1 +0,0 @@
-{}

Dosya farkı çok büyük olduğundan ihmal edildi
+ 38 - 32
example/src/App.tsx


+ 5 - 78
example/README.md

@@ -1,79 +1,6 @@
-This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
+# Usage
+1. Install dependencies by running `yarn install`. This will also run `pod install` for iOS automatically.
+2. Build and run the app by running:
 
-# Getting Started
-
->**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
-
-## Step 1: Start the Metro Server
-
-First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native.
-
-To start Metro, run the following command from the _root_ of your React Native project:
-
-```bash
-# using npm
-npm start
-
-# OR using Yarn
-yarn start
-```
-
-## Step 2: Start your Application
-
-Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app:
-
-### For Android
-
-```bash
-# using npm
-npm run android
-
-# OR using Yarn
-yarn android
-```
-
-### For iOS
-
-```bash
-# using npm
-npm run ios
-
-# OR using Yarn
-yarn ios
-```
-
-If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
-
-This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
-
-## Step 3: Modifying your App
-
-Now that you have successfully run the app, let's modify it.
-
-1. Open `App.tsx` in your text editor of choice and edit some lines.
-2. For **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Developer Menu** (<kbd>Ctrl</kbd> + <kbd>M</kbd> (on Window and Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (on macOS)) to see your changes!
-
-   For **iOS**: Hit <kbd>Cmd ⌘</kbd> + <kbd>R</kbd> in your iOS Simulator to reload the app and see your changes!
-
-## Congratulations! :tada:
-
-You've successfully run and modified your React Native App. :partying_face:
-
-### Now what?
-
-- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
-- If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started).
-
-# Troubleshooting
-
-If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
-
-# Learn More
-
-To learn more about React Native, take a look at the following resources:
-
-- [React Native Website](https://reactnative.dev) - learn more about React Native.
-- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
-- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
-- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
-- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
+   - iOS: `yarn run ios` 
+   - Android: `yarn run android`

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

@@ -69,7 +69,7 @@ def enableProguardInReleaseBuilds = false
  * this variant is about 6MiB larger per architecture than default.
  */
 def jscFlavor = 'org.webkit:android-jsc:+'
-//获取配置文件的版本信息
+
 def getAppVersionName() {
   def inputFile = new File("../package.json")
   def packageJson = new JsonSlurper().parseText(inputFile.text)

example/android/app/src/main/assets/pdf_document.pdf → example/android/app/src/main/assets/PDF_Document.pdf


+ 1 - 1
example/android/settings.gradle

@@ -1,4 +1,4 @@
-rootProject.name = 'CompdfkitPdfExample'
+rootProject.name = 'ComPDFKitRNExample'
 apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
 include ':app'
 includeBuild('../node_modules/@react-native/gradle-plugin')

+ 1 - 1
example/index.js

@@ -1,5 +1,5 @@
 import { AppRegistry } from 'react-native';
-import App from './src/App';
+import App from './App';
 import { name as appName } from './app.json';
 
 AppRegistry.registerComponent(appName, () => App);

+ 21 - 12
src/configuration/CPDFConfiguration.ts

@@ -1,9 +1,18 @@
+/**
+ * Copyright © 2014-2024 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.
+ * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
+ * This notice may not be removed from this file.
+ */
+
 import { BorderWidth, ColorAlpha, CPDFAlignment, CPDFAnnotationType, CPDFBorderStyle, CPDFCheckStyle, CPDFConfigTool, CPDFContentEditorType, CPDFDisplayMode, CPDFFormType, CPDFLineType, CPDFThemes, CPDFToolbarAction, CPDFToolbarMenuAction, CPDFTypeface, CPDFViewMode, DashGap, FontSize, HexColor } from "./CPDFOptions";
 
 /**
- * Configuration information for displaying PDF using the ComPDFKit.openDocument method. 
+ * Configuration information for displaying PDF using the ComPDFKit.openDocument method.
  * Used to configure UI elements, PDF properties, etc.
- * 
+ *
  * @example
  * const configuration : CPDFConfiguration = {
  *    modeConfig: {
@@ -17,7 +26,7 @@ import { BorderWidth, ColorAlpha, CPDFAlignment, CPDFAnnotationType, CPDFBorderS
  *       ]
  *     }
  * }
- * 
+ *
  * ComPDFKit.openDocument(document, 'password', JSON.stringify(configuration))
  */
 export class CPDFConfiguration {
@@ -42,21 +51,21 @@ export class CPDFConfiguration {
     toolbarConfig?: {
         /**
          * Top toolbar actions for Android platform
-         * 
+         *
          * Default: thumbnail, search, bota, menu.
-         * 
+         *
          * {@link CPDFToolbarAction.BACK} button will be shown only on the far left
          */
         androidAvailableActions?: CPDFToolbarAction[],
         /**
           * Left toolbar actions for iOS platform
-          * 
+          *
           * Default: back, thumbnail
           */
         iosLeftBarAvailableActions?: CPDFToolbarAction[],
         /**
          * Right toolbar actions for iOS platform
-         * 
+         *
          * Default: search, bota, menu
          */
         iosRightBarAvailableActions?: CPDFToolbarAction[],
@@ -267,7 +276,7 @@ export class CPDFConfiguration {
          * Available tools, including: Setting, Undo, Redo
          */
         availableTools?: CPDFConfigTool[]
-        
+
         initAttribute?: {
             /**
              * When adding text, the text default properties
@@ -296,12 +305,12 @@ export class CPDFConfiguration {
          * In {@link CPDFViewMode.Forms} mode, the list of form types at the bottom of the view.
          */
         availableTypes?: CPDFFormType[]
-        
+
         /**
          * Only supports {@link CPDFConfigTool.UNDO} and  {@link CPDFConfigTool.UNDO} .
          */
         availableTools?: CPDFConfigTool[]
-        
+
         /**
          * Form default attribute configuration
          */
@@ -408,9 +417,9 @@ export class CPDFConfiguration {
  * @param { HexColor } [fillColor] HEX color: #1460F3
  * @param { HexColor } [borderColor] HEX color: #1460F3
  * @param { BorderWidth } [borderWidth] border thickness, value range:0~10
- * @param { HexColor } [checkedColor] 
+ * @param { HexColor } [checkedColor]
  * @param { boolean } [isChecked]
- * @param { CPDFCheckStyle } [checkedStyle] 
+ * @param { CPDFCheckStyle } [checkedStyle]
  */
 export class CheckBoxAttr {
     fillColor?: HexColor

+ 26 - 15
src/configuration/CPDFOptions.ts

@@ -1,3 +1,13 @@
+/**
+ * Copyright © 2014-2024 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.
+ * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
+ * This notice may not be removed from this file.
+ */
+
+
 export const CPDFViewMode = {
 
     /**
@@ -24,14 +34,15 @@ export const CPDFViewMode = {
 } as const
 export type CPDFViewMode = ValueOf<typeof CPDFViewMode>;
 
+
 /**
  * Toolbar actions supported in the displayed PDF view
  */
 export const CPDFToolbarAction = {
 
 /**
-     * Back button, exits the displayed PDF interface when clicked.  
-     * for Android platform, it will be shown only on the far left of the toolbar.  
+     * Back button, exits the displayed PDF interface when clicked.
+     * for Android platform, it will be shown only on the far left of the toolbar.
      * for iOS platform, it will be displayed according to the configuration position.
      */
     BACK: 'back',
@@ -46,11 +57,11 @@ export const CPDFToolbarAction = {
     SEARCH: 'search',
     /**
      * Display related content in the PDF document
-     * 
-     * b: Bookmark list  
-     * o: Outline list  
-     * t: Thumbnail list  
-     * a: Annotation list  
+     *
+     * b: Bookmark list
+     * o: Outline list
+     * t: Thumbnail list
+     * a: Annotation list
      */
     BOTA: 'bota',
     /**
@@ -63,7 +74,7 @@ export type CPDFToolbarAction = ValueOf<typeof CPDFToolbarAction>;
 
 /**
  * Configure the menu options opened in the top toolbar {@link CPDFToolbarAction.MENU}
- * 
+ *
  */
 export const CPDFToolbarMenuAction = {
 
@@ -180,7 +191,7 @@ export type CPDFConfigTool = ValueOf<typeof CPDFConfigTool>;
 
 
 /**
- * Shape annotation border style, default {@link CPDFBorderStyle.SOLID}.  
+ * Shape annotation border style, default {@link CPDFBorderStyle.SOLID}.
  * shape:
  * * {@link CPDFAnnotationType.SQUARE}
  * * {@link CPDFAnnotationType.CIRCLE}
@@ -201,11 +212,11 @@ export type CPDFBorderStyle = ValueOf<typeof CPDFBorderStyle>;
  */
 export const CPDFLineType = {
     NONE: 'none',
-    OPEN_ARROW: 'openArrow', 
+    OPEN_ARROW: 'openArrow',
     CLOSE_ARROW: 'closedArrow',
     SQUARE: 'square',
-    CIRCLE: 'circle', 
-    DIAMOND: 'diamond' 
+    CIRCLE: 'circle',
+    DIAMOND: 'diamond'
 }
 export type CPDFLineType = ValueOf<typeof CPDFLineType>;
 
@@ -227,7 +238,7 @@ export const CPDFTypeface  = {
     COURIER: 'Courier',
     HELVETICA: 'Helvetica',
     TIMES_ROMAN: 'Times-Roman'
-} as const 
+} as const
 export type CPDFTypeface =  ValueOf<typeof CPDFTypeface>;
 
 
@@ -256,7 +267,7 @@ export const CPDFFormType = {
     SIGNATURES_FIELDS: 'signaturesFields',
 
     PUSH_BUTTON: 'pushButton'
-    
+
 } as const
 export type CPDFFormType = ValueOf<typeof CPDFFormType>;
 
@@ -327,7 +338,7 @@ type ConcatLargestUntilDone<N extends number, R extends never[][], B extends nev
 type Replace<R extends any[], T> = { [K in keyof R]: T }
 
 type TupleOf<T, N extends number> = number extends N ? T[] : {
-  [K in N]: 
+  [K in N]:
   BuildPowersOf2LengthArrays<K, [[never]]> extends infer U ? U extends never[][]
   ? Replace<ConcatLargestUntilDone<K, U, []>, T> : never : never;
 }[N]

+ 42 - 18
src/index.tsx

@@ -1,3 +1,12 @@
+/**
+ * Copyright © 2014-2024 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.
+ * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
+ * This notice may not be removed from this file.
+ */
+
 import { NativeModules } from 'react-native';
 import { CPDFConfiguration } from './configuration/CPDFConfiguration';
 import { CPDFAlignment, CPDFAnnotationType, CPDFBorderStyle, CPDFCheckStyle, CPDFConfigTool, CPDFContentEditorType, CPDFDisplayMode, CPDFFormType, CPDFLineType, CPDFThemes, CPDFToolbarAction, CPDFToolbarMenuAction, CPDFTypeface, CPDFViewMode } from './configuration/CPDFOptions';
@@ -11,7 +20,7 @@ declare module 'react-native' {
        * For example : '2.0.0'
        * @memberof ComPDFKit
        * @returns { Promise<string> } A Promise returning ComPDFKit PDF SDK Version Code
-       * 
+       *
        * @example
        * ComPDFKit.getVersionCode().then((versionCode : string) => {
        *   console.log('ComPDFKit SDK Version:', versionCode)
@@ -20,11 +29,11 @@ declare module 'react-native' {
       getVersionCode(): () => Promise<string>;
       /**
        * Get the build tag of the ComPDFKit PDF SDK.
-       * 
+       *
        * For example: "build_beta_2.0.0_42db96987_202404081007"
        * @memberof ComPDFKit
        * @returns { Promise<string> } A Promise returning ComPDFKit PDF SDK Build Tag.
-       * 
+       *
        * @example
        * ComPDFKit.getSDKBuildTag().then((buildTag : string) => {
        *  console.log('ComPDFKit Build Tag:', buildTag)
@@ -34,27 +43,27 @@ declare module 'react-native' {
       /**
        * Initialize the ComPDFKit PDF SDK using offline authentication.
        * Each ComPDFKit license is bound to a specific app bundle ID(Android Application ID).
-       * 
+       *
        * @method init_
        * @memberof ComPDFKit
        * @param { string } [license] Your ComPDFKit for React Native license key.
        * @returns { Promise<boolean> } Returns ```true``` if initialization is successful, otherwise returns ```false```.
-       * 
+       *
        * @example
        * ComPDFKit.init_('your compdfkit license')
-       * 
+       *
        */
       init_: (license: string) => Promise<boolean>;
       /**
        * Initialize the ComPDFKit PDF SDK using online authentication.
        * Each ComPDFKit license is bound to a specific app bundle ID(Android Application ID).
-       * 
+       *
        * @method initialize
        * @memberof ComPDFKit
        * @param { string } [androidOnlineLicense] Your ComPDFKit for React Native Android online license key.
        * @param { string } [iosOnlineLicense] Your ComPDFKit for React Native iOS online license key.
        * @returns { Promise<boolean> } Returns ```true``` if initialization is successful, otherwise returns ```false```.
-       * 
+       *
        * @example
        * ComPDFKit.initialize('your android compdfkit license', 'your ios compdfkit license')
        */
@@ -64,12 +73,12 @@ declare module 'react-native' {
        * @method openDocument
        * @memberof ComPDFKit
        * @param { string } [document]  document The path to the PDF document to be presented.
-       * 
+       *
        * * (Android) For local storage file path:
        * ```tsx
        *    document = 'file:///storage/emulated/0/Download/sample.pdf'
        * ```
-       * * (Android) For content Uri: 
+       * * (Android) For content Uri:
        * ```tsx
        *    document = 'content://...'
        * ```
@@ -82,17 +91,17 @@ declare module 'react-native' {
        * ```tsx
        *    document = 'pdf_document.pdf'
        * ```
-       * 
+       *
        * @param { string } [password] PDF document password.
        * @param { string } [configuration] Configuration objects to customize the appearance and behavior of ComPDFKit. See [CPDFConfiguration](configuration/CPDFConfiguration.ts)
        * @returns { void }
-       * 
+       *
        * @example
        * const fileName = 'pdf_document.pdf';
-       * const document = 
+       * const document =
        * Platform.OS === 'ios' ? fileName
        * : 'file:///android_asset/' + fileName;
-       * 
+       *
        * const configuration : CPDFConfiguration = {
        *    modeConfig: {
        *       initialViewMode: CPDFModeConfig.ViewMode.VIEWER,
@@ -105,9 +114,9 @@ declare module 'react-native' {
        *       ]
        *     }
        * }
-       * 
+       *
        * ComPDFKit.openDocument(document, 'password', JSON.stringify(configuration))
-       * 
+       *
        */
       openDocument: (document: string, password: string, configuration: string) => void;
     };
@@ -125,7 +134,22 @@ interface ComPDFKit {
 
 const ComPDFKit = NativeModules.ComPDFKit
 
-export { ComPDFKit, CPDFViewMode };
+export { ComPDFKit };
+export { 
+  CPDFViewMode, 
+  CPDFToolbarAction, 
+  CPDFToolbarMenuAction,
+  CPDFAnnotationType,
+  CPDFConfigTool,
+  CPDFBorderStyle,
+  CPDFLineType,
+  CPDFAlignment,
+  CPDFTypeface,
+  CPDFContentEditorType,
+  CPDFFormType,
+  CPDFCheckStyle,
+  CPDFDisplayMode,
+  CPDFThemes } from './configuration/CPDFOptions';
 
 ComPDFKit.getDefaultConfig = getDefaultConfig
 
@@ -407,4 +431,4 @@ function mergeDeep(defaults: any, overrides: any): any {
   }
 
   return merged;
-}
+}