Skip to content

Commit f4d5db5

Browse files
committed
compdfkit(rn) - 2.1.2
1 parent efa77fc commit f4d5db5

47 files changed

Lines changed: 2202 additions & 437 deletions

Some content is hidden

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,4 @@ android/keystores/debug.keystore
7878
# generated by bob
7979
lib/
8080
.github/
81+
/example/ios/Podfile.lock

API.md

Lines changed: 82 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
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.
66

7-
8-
97
## ComPDFKit
108

119
ComPDFKit contains static methods for global library initialization, configuration, and utility methods.
@@ -111,7 +109,7 @@ Parameters:
111109

112110
* (Android) For local storage file path:
113111
```tsx
114-
document = 'file:///storage/emulated/0/Download/sample.pdf'
112+
document = '/storage/emulated/0/Download/PDF_document.pdf'
115113
ComPDFKit.openDocument(document, '', ComPDFKit.getDefaultConfig({}))
116114
```
117115

@@ -140,7 +138,9 @@ ComPDFKit.openDocument(document, '', ComPDFKit.getDefaultConfig({}))
140138

141139
### getDefaultConfig
142140

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:
141+
When using the `ComPDFKit.openDocument` method or the `CPDFReaderView` UI component to display 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:
142+
143+
---
144144

145145
```tsx
146146
ComPDFKit.getDefaultConfig({})
@@ -198,3 +198,81 @@ ComPDFKit.getDefaultConfig({
198198

199199
For more configuration parameter descriptions, please see [CPDFCONFIGURATION.md](./CONFIGURATION.md).
200200

201+
## CPDFReaderView - Props
202+
203+
### Open Document
204+
205+
`CPDFReaderView` is a React component designed to display PDF documents. Below are details about the required `document` prop.
206+
207+
#### document
208+
209+
Specifies the path or URI of the PDF document to be displayed.
210+
211+
* **Type:** `string`
212+
* **Required:** Yes
213+
214+
**Usage Examples:
215+
216+
* (Android) For local storage file path:
217+
218+
```tsx
219+
<CPDFReaderView
220+
document={'/storage/emulated/0/Download/PDF_document.pdf'}/>
221+
```
222+
223+
* (Android) For content Uri:
224+
225+
```tsx
226+
<CPDFReaderView
227+
document={'content://...'}/>
228+
```
229+
230+
* (Android) For assets path:
231+
232+
```tsx
233+
<CPDFReaderView
234+
document={'file:///android_asset/...'}/>
235+
```
236+
237+
* (iOS) For app bundle file path:
238+
239+
```tsx
240+
<CPDFReaderView
241+
document={'pdf_document.pdf'}/>
242+
```
243+
244+
#### password
245+
246+
The password to open the document is an optional parameter.
247+
248+
* **Type:** `string`
249+
250+
**Usage Examples:**
251+
252+
```tsx
253+
<CPDFReaderView
254+
document={'pdf_document.pdf'}
255+
password={'password'}/>
256+
```
257+
258+
#### configuration
259+
260+
Used to pass configuration parameters when rendering a PDF file to customize UI features and PDF view properties. `ComPDFKit` provides default configuration parameters through `ComPDFKit.getDefaultConfig`.
261+
262+
* **Type:**`string`
263+
* **Required:** Yes
264+
265+
**Usage Examples:**
266+
267+
```tsx
268+
<CPDFReaderView
269+
document={samplePDF}
270+
configuration={ComPDFKit.getDefaultConfig({
271+
272+
})}
273+
style={{flex:1}}
274+
/>
275+
```
276+
277+
278+

CHANGELOG.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
## Newest Release
22

3+
### 2.1.2 - 01 Sep 2024
4+
5+
* Added `CPDFReaderView` UI component.
6+
* Optimize document opening speed.
7+
8+
9+
10+
## Previous Release
11+
312
### 2.1.1 - 12 Aug 2024
413

514
* Added the features support for ComPDFKit PDF SDK for iOS V2.1.1.
@@ -8,9 +17,6 @@
817
* Fixed low text contrast issue in dark mode for some documents.
918
* Fixed crash issues with some documents.
1019

11-
12-
## Previous Release
13-
1420
### 2.1.0 - 29 July 2024
1521

1622
* Added the features support for ComPDFKit PDF SDK for iOS V2.1.0.

CONFIGURATION.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,15 @@ var configuration = ComPDFKit.getDefaultConfig({
4949
]
5050
}
5151
})
52+
5253
ComPDFKit.openDocument(document, '', configuration)
54+
55+
// Use in UI components
56+
<CPDFReaderView
57+
document={samplePDF}
58+
configuration={config}
59+
style={{ flex: 1 }}
60+
/>
5361
```
5462

5563
**Flutter**

0 commit comments

Comments
 (0)