pdfjs-viewer-element 2.0.3 → 2.2.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 +28 -6
- package/package.json +1 -1
- package/types/pdfjs-viewer-element.d.ts +8 -8
package/README.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# pdfjs-viewer-element
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/pdfjs-viewer-element)
|
|
4
|
+
[](https://packagequality.com/#?package=pdfjs-viewer-element)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
A web component for viewing pdf files in the browser. The package is based on [PDF.js default viewer](https://mozilla.github.io/pdf.js/web/viewer.html) build and works with any framework. See [demo](https://alekswebnet.github.io/pdfjs-viewer-element/).
|
|
7
|
+
|
|
8
|
+
⚠️ `pdfjs-viewer-element` uses PDF.js [prebuilt](http://mozilla.github.io/pdf.js/getting_started/), that includes the generic build of PDF.js and the viewer. To use the package you should download and **place the prebuilt** files to some directory of your project. Then specify the path to this directory with `viewer-path` property (`/pdfjs` by default).
|
|
6
9
|
|
|
7
10
|
## Install
|
|
8
11
|
```
|
|
@@ -21,20 +24,39 @@ or
|
|
|
21
24
|
|
|
22
25
|
## Usage
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
Place **PDF.js prebuilt** files to some directory of your project (`pdfjs` used as the standard name). See demo [example](https://github.com/alekswebnet/pdfjs-viewer-element/tree/master/public). You may call the directory as you want, but then you should specify the `viewer-path` property.
|
|
25
28
|
|
|
26
29
|
```javascript
|
|
27
30
|
import 'pdfjs-viewer-element'
|
|
28
31
|
```
|
|
29
32
|
|
|
30
33
|
```javascript
|
|
31
|
-
<pdfjs-viewer-element src="/
|
|
34
|
+
<pdfjs-viewer-element src="/file.pdf" viewer-path="/path-to-viewer"></pdfjs-viewer-element>
|
|
32
35
|
```
|
|
33
36
|
|
|
34
37
|
## Properties
|
|
35
38
|
|
|
36
39
|
`src` - path to pdf file.
|
|
37
40
|
|
|
38
|
-
`viewer-path` - path to prebuilt directory (by default
|
|
41
|
+
`viewer-path` - path to prebuilt directory (`/pdfjs` by default).
|
|
42
|
+
|
|
43
|
+
`src` - Path to pdf file
|
|
44
|
+
|
|
45
|
+
`viewer-path` - Path to PDF.js prebuilt
|
|
46
|
+
|
|
47
|
+
`locale` - Language of the interface
|
|
48
|
+
|
|
49
|
+
`page` - Page number
|
|
50
|
+
|
|
51
|
+
`search` - Search text
|
|
52
|
+
|
|
53
|
+
`phrase` - Search by phrase
|
|
54
|
+
|
|
55
|
+
`zoom` - Zoom level
|
|
56
|
+
|
|
57
|
+
`pagemode` - Page mode
|
|
58
|
+
|
|
39
59
|
## License
|
|
40
|
-
[MIT](http://opensource.org/licenses/MIT)
|
|
60
|
+
For this package - [MIT](http://opensource.org/licenses/MIT).
|
|
61
|
+
|
|
62
|
+
For the `pdf.js` library - https://github.com/mozilla/pdf.js/blob/master/LICENSE.
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export declare class PdfjsViewerElement extends HTMLElement {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
constructor();
|
|
3
|
+
static get observedAttributes(): string[];
|
|
4
|
+
connectedCallback(): void;
|
|
5
|
+
attributeChangedCallback(name: string): void;
|
|
6
|
+
updateIframe(): void;
|
|
7
7
|
}
|
|
8
8
|
declare global {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
interface Window {
|
|
10
|
+
PdfjsViewerElement: typeof PdfjsViewerElement;
|
|
11
|
+
}
|
|
12
12
|
}
|
|
13
13
|
export default PdfjsViewerElement;
|