|
4 | 4 |
|
5 | 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 | 6 |
|
7 | | - |
8 | | - |
9 | 7 | ## ComPDFKit |
10 | 8 |
|
11 | 9 | ComPDFKit contains static methods for global library initialization, configuration, and utility methods. |
@@ -111,7 +109,7 @@ Parameters: |
111 | 109 |
|
112 | 110 | * (Android) For local storage file path: |
113 | 111 | ```tsx |
114 | | -document = 'file:///storage/emulated/0/Download/sample.pdf' |
| 112 | +document = '/storage/emulated/0/Download/PDF_document.pdf' |
115 | 113 | ComPDFKit.openDocument(document, '', ComPDFKit.getDefaultConfig({})) |
116 | 114 | ``` |
117 | 115 |
|
@@ -140,7 +138,9 @@ ComPDFKit.openDocument(document, '', ComPDFKit.getDefaultConfig({})) |
140 | 138 |
|
141 | 139 | ### getDefaultConfig |
142 | 140 |
|
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 | +--- |
144 | 144 |
|
145 | 145 | ```tsx |
146 | 146 | ComPDFKit.getDefaultConfig({}) |
@@ -198,3 +198,81 @@ ComPDFKit.getDefaultConfig({ |
198 | 198 |
|
199 | 199 | For more configuration parameter descriptions, please see [CPDFCONFIGURATION.md](./CONFIGURATION.md). |
200 | 200 |
|
| 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 | + |
0 commit comments