@papyrus-sdk/engine-native 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/package.json +22 -3
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Papyrus Engine Native
|
|
2
|
+
|
|
3
|
+
React Native native engine for PDF rendering (PDFKit on iOS, PDFium on Android),
|
|
4
|
+
plus a WebView runtime for EPUB/TXT via `MobileDocumentEngine`.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @papyrus-sdk/engine-native
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
For EPUB/TXT on mobile, also install:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install react-native-webview
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { MobileDocumentEngine, PapyrusPageView } from '@papyrus-sdk/engine-native';
|
|
22
|
+
import { findNodeHandle } from 'react-native';
|
|
23
|
+
|
|
24
|
+
const engine = new MobileDocumentEngine();
|
|
25
|
+
await engine.load({ type: 'pdf', source: { uri: 'https://example.com/book.pdf' } });
|
|
26
|
+
|
|
27
|
+
// Render the first page into a native view
|
|
28
|
+
const viewTag = findNodeHandle(pageViewRef.current);
|
|
29
|
+
if (viewTag) {
|
|
30
|
+
await engine.renderPage(0, viewTag, 2);
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Notes:
|
|
35
|
+
- Requires a native build (not Expo Go).
|
|
36
|
+
- Use `PapyrusPageView` for native PDF rendering.
|
package/package.json
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@papyrus-sdk/engine-native",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"papyrus",
|
|
7
|
+
"react-native",
|
|
8
|
+
"pdf",
|
|
9
|
+
"pdfium",
|
|
10
|
+
"pdfkit",
|
|
11
|
+
"document",
|
|
12
|
+
"sdk",
|
|
13
|
+
"viewer"
|
|
14
|
+
],
|
|
4
15
|
"main": "dist/index.js",
|
|
5
16
|
"module": "dist/index.mjs",
|
|
6
17
|
"types": "dist/index.d.ts",
|
|
@@ -24,9 +35,17 @@
|
|
|
24
35
|
"publishConfig": {
|
|
25
36
|
"access": "public"
|
|
26
37
|
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/solrachix/Papyrus.git"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://solrachix.github.io/Papyrus/",
|
|
43
|
+
"bugs": {
|
|
44
|
+
"url": "https://github.com/solrachix/Papyrus/issues"
|
|
45
|
+
},
|
|
27
46
|
"dependencies": {
|
|
28
|
-
"@papyrus-sdk/core": "0.1.
|
|
29
|
-
"@papyrus-sdk/types": "0.1.
|
|
47
|
+
"@papyrus-sdk/core": "0.1.3",
|
|
48
|
+
"@papyrus-sdk/types": "0.1.3"
|
|
30
49
|
},
|
|
31
50
|
"peerDependencies": {
|
|
32
51
|
"react-native": ">=0.76.0"
|