@monime/pdfio 0.1.0
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 +71 -0
- package/dist/PdfViewer.d.ts +5 -0
- package/dist/PdfViewer.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +509 -0
- package/dist/index.js.map +1 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# `@monime/pdfio`
|
|
2
|
+
|
|
3
|
+
A simple custom PDF viewer for React, built with Vite and managed with `pnpm`.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Preview PDFs from a remote URL, `File`, `Blob`, or `Uint8Array`
|
|
8
|
+
- Built-in previous/next page controls
|
|
9
|
+
- Zoom in, zoom out, and reset actions
|
|
10
|
+
- Vite-based demo app for local development
|
|
11
|
+
- Library build ready to publish to npm
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @monime/pdfio react react-dom
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This package also relies on `pdfjs-dist`, which is installed automatically as a dependency.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { PdfViewer } from '@monime/pdfio';
|
|
25
|
+
import '@monime/pdfio/style.css';
|
|
26
|
+
|
|
27
|
+
export function Example() {
|
|
28
|
+
return (
|
|
29
|
+
<PdfViewer
|
|
30
|
+
file="https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf"
|
|
31
|
+
height={700}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Local development
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm install
|
|
41
|
+
pnpm dev
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Build the package
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pnpm build
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This generates:
|
|
51
|
+
|
|
52
|
+
- `dist/index.js`
|
|
53
|
+
- `dist/index.cjs`
|
|
54
|
+
- `dist/index.d.ts`
|
|
55
|
+
- `dist/style.css`
|
|
56
|
+
|
|
57
|
+
## Demo build
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pnpm build:demo
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
This writes the standalone demo app to `demo-dist/`.
|
|
64
|
+
|
|
65
|
+
## Publish
|
|
66
|
+
|
|
67
|
+
Update the package version, then publish with:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pnpm publish --access public
|
|
71
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PdfViewer.d.ts","sourceRoot":"","sources":["../src/lib/PdfViewer.tsx"],"names":[],"mappings":"AA0CA,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAID,wBAAgB,SAAS,CAAC,EACxB,GAA8C,GAC/C,EAAE,cAAc,2CA+ahB"}
|