pdfjs-viewer-element 2.4.0 → 2.4.1

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.
Files changed (2) hide show
  1. package/README.md +10 -8
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # pdfjs-viewer-element
2
2
 
3
- A custom element, based on [PDF.js default viewer](https://mozilla.github.io/pdf.js/web/viewer.html). Supported in all [major browsers](https://caniuse.com/custom-elementsv1) and works with most [JS frameworks](https://custom-elements-everywhere.com/). See [examples](https://alekswebnet.github.io/pdfjs-viewer-element/#demo) of usage in the different frameworks.
3
+ A custom element, based on [PDF.js default viewer](https://mozilla.github.io/pdf.js/web/viewer.html). Supported in all [major browsers](https://caniuse.com/custom-elementsv1) and works with most [JS frameworks](https://custom-elements-everywhere.com/). See [examples](https://alekswebnet.github.io/pdfjs-viewer-element/#demo) of usage in Vue, React and Svelte or pure HTML.
4
4
 
5
5
  ⚠️ `pdfjs-viewer-element` requires 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](http://mozilla.github.io/pdf.js/getting_started/) 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
6
 
@@ -16,7 +16,7 @@ You have full access to PDF.js viewer application using `initialize` method.
16
16
 
17
17
  [Getting started](https://alekswebnet.github.io/pdfjs-viewer-element/)
18
18
 
19
- [Api](https://alekswebnet.github.io/pdfjs-viewer-element/#api)
19
+ [API](https://alekswebnet.github.io/pdfjs-viewer-element/#api)
20
20
 
21
21
  [Live examples](https://alekswebnet.github.io/pdfjs-viewer-element/#demo)
22
22
 
@@ -74,12 +74,14 @@ For more clarity, see the [Api docs page](https://alekswebnet.github.io/pdfjs-vi
74
74
  `initialize` - using this method you can access PDFViewerApplication and use methods and events of PDF.js default viewer
75
75
 
76
76
  ```javascript
77
- document.addEventListener('DOMContentLoaded', async () => {
78
- const viewer = document.querySelector('pdfjs-viewer-element')
79
- // Wait for the viewer initialization, receive PDFViewerApplication
80
- const viewerApp = await viewer.initialize()
81
- // Open PDF file data using Uint8Array instead of URL
82
- viewerApp.open(pdfData)
77
+ const viewer = document.querySelector('pdfjs-viewer-element')
78
+ // Wait for the viewer initialization, receive PDFViewerApplication
79
+ const viewerApp = await viewer.initialize()
80
+ // Open PDF file data using Uint8Array instead of URL
81
+ viewerApp.open(pdfData)
82
+ // Use event bus to handle viewer application events
83
+ viewerApp.eventBus.on('pagesloaded', () => {
84
+ console.log('Viewer pages loaded')
83
85
  })
84
86
  ```
85
87
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdfjs-viewer-element",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Oleksandr Shevchuk",