Skip to content

Commit e19cd18

Browse files
committed
Add latest PDF.js build, fix CSS theme setting
1 parent 8edddd3 commit e19cd18

File tree

495 files changed

+109375
-104537
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

495 files changed

+109375
-104537
lines changed

README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ See [examples](https://alekswebnet.github.io/pdfjs-viewer-element/#demo) of usag
66

77
⚠️ `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.
88

9-
The prebuilt comes with each PDF.js release. Supported releases:
9+
The prebuilt comes with each PDF.js release. Supported 3 latest releases:
1010

11-
🚧 [v3.11.174](https://github.com/mozilla/pdf.js/releases/tag/v3.11.174) (partial)
11+
[v4.0.189](https://github.com/mozilla/pdf.js/releases/tag/v4.0.189)
1212

13-
[v3.10.111](https://github.com/mozilla/pdf.js/releases/tag/v3.10.111)
13+
[v3.11.174](https://github.com/mozilla/pdf.js/releases/tag/v3.11.174)
1414

15-
[v3.9.179](https://github.com/mozilla/pdf.js/releases/tag/v3.9.179)
15+
[v3.10.111](https://github.com/mozilla/pdf.js/releases/tag/v3.10.111)
1616

1717
To use the package you should download and **place the prebuilt** files to some directory of your project.
1818

@@ -79,12 +79,24 @@ Using browser:
7979

8080
`pagemode` - Page mode `thumbs | bookmarks | attachments | layers | none`
8181

82-
`viewer-css-theme` - Apply automatic, light or dark theme `AUTOMATIC | LIGHT | DARK`. Default is `AUTOMATIC`
82+
`viewer-css-theme` - Apply automatic, light or dark theme `AUTOMATIC | LIGHT | DARK`
8383

8484
`viewer-extra-styles` - Add your CSS rules to viewer application
8585

8686
For more clarity, see the [Api docs page](https://alekswebnet.github.io/pdfjs-viewer-element/#api).
8787

88+
## Viewer CSS theme
89+
90+
Use `viewer-css-theme` attribute to set light or dark theme manually:
91+
92+
```html
93+
<pdfjs-viewer-element
94+
src="/file.pdf"
95+
viewer-path="/path-to-viewer"
96+
viewer-css-theme="DARK">
97+
</pdfjs-viewer-element>
98+
```
99+
88100
## Viewer extra styles
89101

90102
You can add your own CSS rules to the viewer application using `viewer-extra-styles` attribute:
@@ -111,7 +123,7 @@ const viewer = document.querySelector('pdfjs-viewer-element')
111123
// Wait for the viewer initialization, receive PDFViewerApplication
112124
const viewerApp = await viewer.initialize()
113125
// Open PDF file data using Uint8Array instead of URL
114-
viewerApp.open(pdfData)
126+
viewerApp.open({ data: pdfData })
115127
// Use event bus to handle viewer application events
116128
viewerApp.eventBus.on('pagesloaded', () => {
117129
console.log('Viewer pages loaded')

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
// Wait for the viewer initialization
7979
const viewerApp = await viewer.initialize()
8080
// Open PDF file data using Uint8Array instead of URL
81-
viewerApp.open(pdfData)
81+
viewerApp.open({ data: pdfData })
8282
})
8383
</script>
8484
</html>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pdfjs-viewer-element",
3-
"version": "2.5.2",
3+
"version": "2.5.3",
44
"license": "MIT",
55
"author": {
66
"name": "Oleksandr Shevchuk",

public/pdfjs-3.9.179-dist/build/pdf.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/pdfjs-3.9.179-dist/build/pdf.sandbox.js

Lines changed: 0 additions & 282 deletions
This file was deleted.

public/pdfjs-3.9.179-dist/build/pdf.sandbox.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/pdfjs-3.9.179-dist/build/pdf.worker.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/pdfjs-3.9.179-dist/web/locale/ach/viewer.properties

Lines changed: 0 additions & 179 deletions
This file was deleted.

0 commit comments

Comments
 (0)