@pdfslick/react 1.2.2 → 1.2.4
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 +14 -4
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/umd/index.d.ts.map +1 -1
- package/dist/umd/index.js +3 -3
- package/package.json +28 -15
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|

|
|
4
4
|
|
|
5
5
|
<br><br>
|
|
6
|
+
|
|
6
7
|
<div align="center">
|
|
7
8
|
View and Interact with PDF documents in React apps
|
|
8
9
|
<br><br>
|
|
@@ -10,9 +11,11 @@ View and Interact with PDF documents in React apps
|
|
|
10
11
|
[Getting Started](https://pdfslick.dev/docs) | [Examples](https://pdfslick.dev/examples)
|
|
11
12
|
|
|
12
13
|
<br><br>
|
|
14
|
+
|
|
13
15
|
</div>
|
|
14
16
|
|
|
15
17
|
---
|
|
18
|
+
|
|
16
19
|
<br>
|
|
17
20
|
|
|
18
21
|
PDFSlick for React is a library which enables viewing of and interaction with PDF documents in React apps.
|
|
@@ -21,6 +24,7 @@ It's build on top of Mozilla's [PDF.js](https://github.com/mozilla/pdf.js), and
|
|
|
21
24
|
## Getting started with PDFSlick for React
|
|
22
25
|
|
|
23
26
|
To get started with React run:
|
|
27
|
+
|
|
24
28
|
```shell
|
|
25
29
|
npm install @pdfslick/react
|
|
26
30
|
# yarn add @pdfslick/react
|
|
@@ -28,6 +32,7 @@ npm install @pdfslick/react
|
|
|
28
32
|
```
|
|
29
33
|
|
|
30
34
|
You can start using PDFSlick with the `usePDFSlick()` hook, like with the following basic example:
|
|
35
|
+
|
|
31
36
|
```jsx
|
|
32
37
|
import { usePDFSlick } from "@pdfslick/react";
|
|
33
38
|
import PDFNavigation from "./yourcomponents/PDFNavigation";
|
|
@@ -39,13 +44,16 @@ import PDFNavigation from "./yourcomponents/PDFNavigation";
|
|
|
39
44
|
import "@pdfslick/react/dist/pdf_viewer.css";
|
|
40
45
|
|
|
41
46
|
type PDFViewerComponentProps = {
|
|
42
|
-
pdfFilePath: string
|
|
47
|
+
pdfFilePath: string,
|
|
43
48
|
};
|
|
44
49
|
|
|
45
50
|
const PDFViewerComponent = ({ pdfFilePath }: PDFViewerComponent) => {
|
|
46
|
-
const { viewerRef, usePDFSlickStore, PDFSlickViewer } = usePDFSlick(
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
const { viewerRef, usePDFSlickStore, PDFSlickViewer } = usePDFSlick(
|
|
52
|
+
pdfFilePath,
|
|
53
|
+
{
|
|
54
|
+
scaleValue: "page-fit",
|
|
55
|
+
}
|
|
56
|
+
);
|
|
49
57
|
|
|
50
58
|
/*
|
|
51
59
|
Access the store with `usePDFSlickStore()` hook — you can pass is
|
|
@@ -85,6 +93,7 @@ export default PDFViewerComponent;
|
|
|
85
93
|
```
|
|
86
94
|
|
|
87
95
|
Provided with the PDF Document path and PDFSlick options object, the `usePDFSlick()` hook returns an object consisting (among the other things) of:
|
|
96
|
+
|
|
88
97
|
- `PDFSlickViewer` is the PDF Viewer component used for viewing the PDF document
|
|
89
98
|
- `viewerRef` is the `ref` callback that is provided as a prop to the `<PDFSlickViewer />` component
|
|
90
99
|
- `usePDFSlickStore` enables using PDFSlick store within your React components
|
|
@@ -94,5 +103,6 @@ Provided with the PDF Document path and PDFSlick options object, the `usePDFSlic
|
|
|
94
103
|
[More on using PDFSlick with React](https://pdfslick.dev/docs/react) | [Checkout the React Examples](./apps/web/examples)
|
|
95
104
|
|
|
96
105
|
## Thanks
|
|
106
|
+
|
|
97
107
|
- [Vane Kosturanov](https://kosturanov.com/portfolio/logo-branding-design) for designing the logo
|
|
98
108
|
- [VS Code Icons](https://github.com/microsoft/vscode-codicons) for the icons used throughout the examples
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -45,7 +45,7 @@ function PDFSlickThumbnails({ children: renderChild, thumbsRef, usePDFSlickStore
|
|
|
45
45
|
} }, { className }, { style: {
|
|
46
46
|
position: "absolute",
|
|
47
47
|
overflow: "auto",
|
|
48
|
-
inset: 0
|
|
48
|
+
inset: 0,
|
|
49
49
|
} }, { children: Array.from(thumbnailViews).map(([pageNumber, view]) => {
|
|
50
50
|
var _a;
|
|
51
51
|
return createPortal(renderChild({
|
package/dist/umd/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC"}
|