Skip to content

Commit dcd2fd1

Browse files
committed
compdfkit(rn) - ComPDFKit PDF SDK for React Native Library v2.0.1-Beta.1
1 parent 352d9c3 commit dcd2fd1

File tree

144 files changed

+7581
-6156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+7581
-6156
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
9+
indent_style = space
10+
indent_size = 2
11+
12+
end_of_line = lf
13+
charset = utf-8
14+
trim_trailing_whitespace = true
15+
insert_final_newline = true

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.pbxproj -text
2+
# specific for windows script files
3+
*.bat text eol=crlf

.gitignore

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# XDE
6+
.expo/
7+
8+
# VSCode
9+
.vscode/
10+
jsconfig.json
11+
12+
# Xcode
13+
#
14+
build/
15+
*.pbxuser
16+
!default.pbxuser
17+
*.mode1v3
18+
!default.mode1v3
19+
*.mode2v3
20+
!default.mode2v3
21+
*.perspectivev3
22+
!default.perspectivev3
23+
xcuserdata
24+
*.xccheckout
25+
*.moved-aside
26+
DerivedData
27+
*.hmap
28+
*.ipa
29+
*.xcuserstate
30+
project.xcworkspace
31+
32+
# Android/IJ
33+
#
34+
.classpath
35+
.cxx
36+
.gradle
37+
.idea
38+
.project
39+
.settings
40+
local.properties
41+
android.iml
42+
43+
# Cocoapods
44+
#
45+
example/ios/Pods
46+
47+
# Ruby
48+
example/vendor/
49+
50+
# node.js
51+
#
52+
node_modules/
53+
npm-debug.log
54+
yarn-debug.log
55+
yarn-error.log
56+
yarn.lock
57+
58+
# BUCK
59+
buck-out/
60+
\.buckd/
61+
android/app/libs
62+
android/keystores/debug.keystore
63+
64+
# Yarn
65+
.yarn/*
66+
!.yarn/patches
67+
!.yarn/plugins
68+
!.yarn/releases
69+
!.yarn/sdks
70+
!.yarn/versions
71+
72+
# Expo
73+
.expo/
74+
75+
# Turborepo
76+
.turbo/
77+
78+
# generated by bob
79+
lib/
80+
.github/

.npmignore

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# XDE
6+
.expo/
7+
8+
# VSCode
9+
.vscode/
10+
jsconfig.json
11+
12+
# Xcode
13+
#
14+
build/
15+
*.pbxuser
16+
!default.pbxuser
17+
*.mode1v3
18+
!default.mode1v3
19+
*.mode2v3
20+
!default.mode2v3
21+
*.perspectivev3
22+
!default.perspectivev3
23+
xcuserdata
24+
*.xccheckout
25+
*.moved-aside
26+
DerivedData
27+
*.hmap
28+
*.ipa
29+
*.xcuserstate
30+
project.xcworkspace
31+
32+
# Android/IJ
33+
#
34+
.classpath
35+
.cxx
36+
.gradle
37+
.idea
38+
.project
39+
.settings
40+
local.properties
41+
android.iml
42+
43+
# Cocoapods
44+
#
45+
example/ios/Pods
46+
47+
# Ruby
48+
example/vendor/
49+
50+
# node.js
51+
#
52+
node_modules/
53+
npm-debug.log
54+
yarn-debug.log
55+
yarn-error.log
56+
yarn.lock
57+
58+
# BUCK
59+
buck-out/
60+
\.buckd/
61+
android/app/libs
62+
android/keystores/debug.keystore
63+
64+
# Yarn
65+
.yarn/*
66+
!.yarn/patches
67+
!.yarn/plugins
68+
!.yarn/releases
69+
!.yarn/sdks
70+
!.yarn/versions
71+
72+
# Expo
73+
.expo/
74+
75+
# Turborepo
76+
.turbo/
77+
78+
# generated by bob
79+
lib/
80+
.github/

API.md

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
# ComPDFKit React Native API
2+
3+
## TypeScript
4+
5+
ComPDFKit React Native supports TypeScript. Types used in this document will be described using TypeScript types. Type information is automatically provided when encoding, and the exact type aliases and constants used in our custom types can be found in the [CPDFConfiguration](./src/configuration/CPDFConfiguration.ts) and [CPDFOptions](./src/configuration/CPDFOptions.ts) source folders.
6+
7+
8+
9+
## ComPDFKit
10+
11+
ComPDFKit contains static methods for global library initialization, configuration, and utility methods.
12+
13+
14+
15+
### init_
16+
17+
Initialize the ComPDFKit SDK offline using your ComPDFKit commercial license key. Please contact our sales to obtain a trial license.
18+
19+
Parameters:
20+
21+
| Name | Type | Description |
22+
| ------- | ------ | -------------------------- |
23+
| license | String | Your ComPDFKit license key |
24+
25+
Returns a Promise.
26+
27+
| Name | Type | Description |
28+
| ------ | ------- | ------------------------------------------------------------ |
29+
| result | boolean | Returns ```true``` if initialization is successful, otherwise returns ```false```. |
30+
31+
```tsx
32+
ComPDFKit.init_('your compdfkit license')
33+
```
34+
35+
36+
37+
### initialize
38+
39+
Use your ComPDFKit commercial license key to initialize the ComPDFKit SDK using online authentication. Please contact our sales to obtain a trial license.
40+
41+
Parameters:
42+
43+
| Name | Type | Description |
44+
| -------------------- | ------ | ----------------------------------------------------------- |
45+
| androidOnlineLicense | string | Your ComPDFKit for React Native Android online license key. |
46+
| iosOnlineLicense | string | Your ComPDFKit for React Native iOS online license key. |
47+
48+
Returns a Promise.
49+
50+
| Name | Type | Description |
51+
| ------ | ------- | ------------------------------------------------------------ |
52+
| result | boolean | Returns ```true``` if initialization is successful, otherwise returns ```false```. |
53+
54+
```tsx
55+
ComPDFKit.initialize('android online license', 'ios online license')
56+
```
57+
58+
59+
60+
### getVersionCode
61+
62+
Get the version number of the ComPDFKit SDK.
63+
64+
For example: '2.0.1'
65+
66+
Returns a Promise.
67+
68+
| Name | Type | Description |
69+
| ----------- | ------ | ---------------------------------------- |
70+
| versionCode | String | the version number of the ComPDFKit SDK. |
71+
72+
```tsx
73+
ComPDFKit.getVersionCode().then((versionCode : string) => {
74+
console.log('ComPDFKit SDK Version:', versionCode)
75+
})
76+
```
77+
78+
79+
80+
### getSDKBuildTag
81+
82+
Get the build tag of the ComPDFKit PDF SDK.
83+
84+
For example: "build_beta_2.0.0_42db96987_202404081007"
85+
86+
Returns a Promise.
87+
88+
| Name | Type | Description |
89+
| -------- | ------ | --------------------------------------- |
90+
| buildTag | String | the build tag of the ComPDFKit PDF SDK. |
91+
92+
```tsx
93+
ComPDFKit.getSDKBuildTag().then((buildTag : string) => {
94+
console.log('ComPDFKit Build Tag:', buildTag)
95+
})
96+
```
97+
98+
99+
100+
### openDocument
101+
102+
Used to present a PDF document.
103+
104+
Parameters:
105+
106+
| Name | Type | Description |
107+
| ------------- | ------ | ------------------------------------------------------------ |
108+
| document | string | The path to the PDF document to be presented. |
109+
| password | string | PDF document password. |
110+
| configuration | string | Configuration objects to customize the appearance and behavior of ComPDFKit. |
111+
112+
* (Android) For local storage file path:
113+
```tsx
114+
document = 'file:///storage/emulated/0/Download/sample.pdf'
115+
ComPDFKit.openDocument(document, '', ComPDFKit.getDefaultConfig({}))
116+
```
117+
118+
* (Android) For content Uri:
119+
120+
```tsx
121+
document = 'content://...'
122+
ComPDFKit.openDocument(document, '', ComPDFKit.getDefaultConfig({}))
123+
```
124+
125+
* (Android) For assets path:
126+
127+
```tsx
128+
document = "file:///android_asset/..."
129+
ComPDFKit.openDocument(document, '', ComPDFKit.getDefaultConfig({}))
130+
```
131+
132+
* (iOS) For app bundle file path:
133+
134+
```tsx
135+
document = 'pdf_document.pdf'
136+
ComPDFKit.openDocument(document, '', ComPDFKit.getDefaultConfig({}))
137+
```
138+
139+
140+
141+
### getDefaultConfig
142+
143+
When you use the `ComPDFKit.openDocument` method to present a PDF file, you need to pass configuration parameters to customize the UI features and PDF view properties. `ComPDFKit` provides default configuration parameters through `ComPDFKit.getDefaultConfig`. You can retrieve them using the following example:
144+
145+
```tsx
146+
ComPDFKit.getDefaultConfig({})
147+
```
148+
149+
You can modify certain parameters to meet your requirements. Here are some usage examples:
150+
151+
1. Setting the initial display mode and available mode list. The following code is an example that enables only the viewer mode and annotation mode:
152+
153+
```tsx
154+
ComPDFKit.getDefaultConfig({
155+
modeConfig: {
156+
initialViewMode: CPDFViewMode.VIEWER,
157+
availableViewModes: [
158+
CPDFViewMode.VIEWER,
159+
CPDFViewMode.ANNOTATIONS
160+
]
161+
}
162+
})
163+
```
164+
165+
2. Setting the enabled annotation types and the default annotation attribute values list. For example, enabling only note annotations and setting the color and transparency of note annotations:
166+
167+
```tsx
168+
ComPDFKit.getDefaultConfig({
169+
annotationsConfig:{
170+
availableType:[
171+
CPDFAnnotationType.NOTE
172+
],
173+
availableTools:[
174+
CPDFConfigTool.SETTING,
175+
CPDFConfigTool.UNDO,
176+
CPDFConfigTool.REDO
177+
],
178+
initAttribute:{
179+
note:{
180+
color: '#1460F3',
181+
alpha: 255
182+
}
183+
}
184+
}
185+
})
186+
```
187+
188+
3.Setting the display mode and page turning direction:
189+
190+
```tsx
191+
ComPDFKit.getDefaultConfig({
192+
readerViewConfig:{
193+
displayMode: CPDFDisplayMode.DOUBLE_PAGE,
194+
verticalMode: false
195+
}
196+
})
197+
```
198+
199+
For more configuration parameter descriptions, please see [CPDFCONFIGURATION.md](./CONFIGURATION.md).
200+

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Newest Release
2+
3+
### 2.0.1-beta.1 - 17 May 2024
4+
5+
* Provide dependency methods from GitHub and npm.
6+
7+
* Added the features support for ComPDFKit PDF SDK for iOS V2.0.1.
8+
* Added the features support for ComPDFKit PDF SDK for Android V2.0.1.
9+
* Fix the issue of continuous memory growth.
10+
11+
12+
13+
14+
## Previous Release

0 commit comments

Comments
 (0)