Skip to content

Commit 50a80b9

Browse files
committed
Update readme
1 parent 8ff891f commit 50a80b9

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

README.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pdfjs-viewer-element
22

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.
3+
A custom element, based on [PDF.js default viewer](https://mozilla.github.io/pdf.js/web/viewer.html) and . 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.
44

55
⚠️ `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).
66

@@ -47,15 +47,15 @@ Using browser:
4747
<pdfjs-viewer-element src="/file.pdf" viewer-path="/path-to-viewer"></pdfjs-viewer-element>
4848
```
4949

50-
## Properties
50+
## Attributes
5151

5252
`src` - PDF file URL, should refer to the [same origin](https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#can-i-load-a-pdf-from-another-server-cross-domain-request)
5353

5454
`viewer-path` - Path to PDF.js [prebuilt](http://mozilla.github.io/pdf.js/getting_started/)
5555

56-
`locale` - Specifies which language to use in the viewer UI. For a list of the available locales, see [all l10n files](https://github.com/mozilla/pdf.js/tree/master/l10n)
56+
`locale` - Specifies which language to use in the viewer UI `en-US | ...`. [Available locales](https://github.com/mozilla/pdf.js/tree/master/l10n)
5757

58-
`text-layer` - Text layer, that is used for text selection
58+
`text-layer` - Text layer, that is used for text selection `off | visible | shadow | hover`
5959

6060
`page` - Page number
6161

@@ -67,12 +67,33 @@ Using browser:
6767

6868
`pagemode` - Page mode
6969

70+
`viewer-css-theme` - Apply automatic, light or dark theme `AUTOMATIC | LIGHT | DARK`. Default is `AUTOMATIC`
71+
72+
`viewer-extra-styles` - Add your CSS rules to viewer application
73+
7074
For more clarity, see the [Api docs page](https://alekswebnet.github.io/pdfjs-viewer-element/#api).
7175

76+
## Viewer extra styles
77+
78+
You can add your own CSS rules to the viewer application using `viewer-extra-styles` attribute:
79+
80+
```html
81+
<!-- Hide open file button -->
82+
<pdfjs-viewer-element
83+
src="/file.pdf"
84+
viewer-path="/path-to-viewer"
85+
viewer-extra-styles="#openFile { display: none }">
86+
</pdfjs-viewer-element>
87+
```
88+
7289
## PDF.js Viewer Application
7390

7491
`initialize` - using this method you can access PDFViewerApplication and use methods and events of PDF.js default viewer
7592

93+
```html
94+
<pdfjs-viewer-element viewer-path="/path-to-viewer"></pdfjs-viewer-element>
95+
```
96+
7697
```javascript
7798
const viewer = document.querySelector('pdfjs-viewer-element')
7899
// Wait for the viewer initialization, receive PDFViewerApplication
@@ -86,4 +107,4 @@ viewerApp.eventBus.on('pagesloaded', () => {
86107
```
87108

88109
## License
89-
[MIT](http://opensource.org/licenses/MIT)
110+
[MIT](http://opensource.org/licenses/MIT)

0 commit comments

Comments
 (0)