Skip to content

Commit 8848adf

Browse files
committed
Fix styles injecting #37, update readme, update deps, update demos
1 parent 791df73 commit 8848adf

13 files changed

+1037
-1187
lines changed

README.md

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,32 @@
1-
<p align="center">
2-
<img src="https://alekswebnet.github.io/pdfjs-viewer-element/logo.svg" width="60"/>
3-
</p>
4-
<h1 align="center">pdfjs-viewer-element</h1>
1+
# pdfjs-viewer-element
2+
3+
Custom element that embeds [PDF.js default viewer](https://mozilla.github.io/pdf.js/web/viewer.html) using the `iframe`.
54

6-
The simplest integration of [PDF.js default viewer](https://mozilla.github.io/pdf.js/web/viewer.html) using the `iframe` element and web component.
75
The package provides a custom element, based on PDF.js [viewer options](https://github.com/mozilla/pdf.js/wiki/Viewer-options) and [URL parameters](https://github.com/mozilla/pdf.js/wiki/Debugging-PDF.js#url-parameters) API.
6+
87
Supported in all [major browsers](https://caniuse.com/custom-elementsv1), and works with most [JS frameworks](https://custom-elements-everywhere.com/).
98

10-
See [demo pages](https://github.com/alekswebnet/pdfjs-viewer-element/tree/master/demo) for various usecases.
11-
See [live examples](https://alekswebnet.github.io/pdfjs-viewer-element/#demo) of usage with frameworks.
9+
[![npm version](https://img.shields.io/npm/v/pdfjs-viewer-element?logo=npm&logoColor=fff)](https://www.npmjs.com/package/pdfjs-viewer-element)
10+
[![Package Quality](https://packagequality.com/shield/pdfjs-viewer-element.svg)](https://packagequality.com/#?package=pdfjs-viewer-element)
11+
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/pdfjs-viewer-element)
12+
13+
![PDF.js viewer](image.webp)
1214

1315
## Features
1416

1517
- Simple PDF.js viewer integration to any web application
16-
- PDF.js viewer options and parameters support, access to the viewer application instance
17-
- Ability to customize viewer styles and themes
18-
19-
## How it works
18+
- PDF.js viewer options and parameters support, access the viewer application instance
19+
- Customize viewer styles and themes
2020

21-
**⚠️ This is an important part, please read this FIRST !!!**
22-
23-
**You should download and place the PDF.js prebuilt files in the project.**
24-
25-
`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.
21+
## Docs
2622

27-
The prebuilt comes with each PDF.js release.
28-
All v4 and v3 [releases](https://github.com/mozilla/pdf.js/releases) are supported.
23+
[Getting started](https://alekswebnet.github.io/pdfjs-viewer-element/)
2924

30-
Then specify the path to the directory with the `viewer-path` property (`/pdfjs` by default) and PDF file URL with `src` property (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)).
25+
[API playground](https://alekswebnet.github.io/pdfjs-viewer-element/#api)
3126

32-
## Status
27+
[Usage with frameworks](https://alekswebnet.github.io/pdfjs-viewer-element/#demo)
3328

34-
[![npm version](https://img.shields.io/npm/v/pdfjs-viewer-element?logo=npm&logoColor=fff)](https://www.npmjs.com/package/pdfjs-viewer-element)
35-
[![Package Quality](https://packagequality.com/shield/pdfjs-viewer-element.svg)](https://packagequality.com/#?package=pdfjs-viewer-element)
36-
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/pdfjs-viewer-element)
29+
[Various usecases](https://github.com/alekswebnet/pdfjs-viewer-element/tree/master/demo)
3730

3831
## Support via Ko-fi
3932

@@ -43,19 +36,22 @@ If you find `pdfjs-viewer-element` useful and want to support its development, c
4336

4437
> ❤️ Your support helps with maintenance, bug fixes, and long-term improvements.
4538
46-
## Docs
39+
## How it works
4740

48-
[Getting started](https://alekswebnet.github.io/pdfjs-viewer-element/)
41+
**⚠️ This is an important part, please read this FIRST !!!**
4942

50-
[API playground](https://alekswebnet.github.io/pdfjs-viewer-element/#api)
43+
**You should download and place the PDF.js prebuilt files in the project.**
44+
45+
`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.
5146

52-
[Live examples](https://alekswebnet.github.io/pdfjs-viewer-element/#demo)
47+
The prebuilt comes with each PDF.js release.
48+
All v4 and v3 [releases](https://github.com/mozilla/pdf.js/releases) are supported.
5349

54-
[Demo pages](https://github.com/alekswebnet/pdfjs-viewer-element/tree/master/demo)
50+
Then specify the path to the directory with the `viewer-path` property (`/pdfjs` by default) and PDF file URL with `src` property (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)).
5551

5652
## Install
5753

58-
Using module bundlers:
54+
### Using module bundlers:
5955

6056
```bash
6157
# With npm
@@ -70,7 +66,7 @@ pnpm add pdfjs-viewer-element
7066
import 'pdfjs-viewer-element'
7167
```
7268

73-
Using browser:
69+
### Using browser and CDN:
7470

7571
```html
7672
<script type="module" src="https://cdn.skypack.dev/pdfjs-viewer-element"></script>

demo/basic.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>pdfjs-viewer-element | Basic demo</title>
7-
<script type="module" src="./../../dist/pdfjs-viewer-element.js"></script>
7+
<script type="module" src="https://cdn.skypack.dev/pdfjs-viewer-element"></script>
88
<style>
99
body {
1010
margin: 0;

demo/dark-theme.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>pdfjs-viewer-element | Dark theme demo</title>
7-
<script type="module" src="./../../dist/pdfjs-viewer-element.js"></script>
7+
<script type="module" src="https://cdn.skypack.dev/pdfjs-viewer-element"></script>
88
<style>
99
body {
1010
margin: 0;

demo/extra-styles-urls.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>pdfjs-viewer-element | Extra styles demo</title>
7-
<script type="module" src="./../../dist/pdfjs-viewer-element.js"></script>
7+
<script type="module" src="https://cdn.skypack.dev/pdfjs-viewer-element"></script>
88
<style>
99
body {
1010
margin: 0;

demo/extra-styles.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>pdfjs-viewer-element | Extra styles demo</title>
7-
<script type="module" src="./../../dist/pdfjs-viewer-element.js"></script>
7+
<script type="module" src="https://cdn.skypack.dev/pdfjs-viewer-element"></script>
88
<style>
99
body {
1010
margin: 0;

demo/go-to-nameddest.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>pdfjs-viewer-element | Disable font face demo</title>
7-
<script type="module" src="./../../dist/pdfjs-viewer-element.js"></script>
7+
<script type="module" src="https://cdn.skypack.dev/pdfjs-viewer-element"></script>
88
<style>
99
body {
1010
margin: 0;

demo/opened-findbar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>pdfjs-viewer-element | Opened find bar demo</title>
7-
<script type="module" src="./../../dist/pdfjs-viewer-element.js"></script>
7+
<script type="module" src="https://cdn.skypack.dev/pdfjs-viewer-element"></script>
88
<style>
99
body {
1010
margin: 0;

demo/pdf-data-load.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>pdfjs-viewer-element | Basic demo</title>
7-
<script type="module" src="./../../dist/pdfjs-viewer-element.js"></script>
7+
<script type="module" src="https://cdn.skypack.dev/pdfjs-viewer-element"></script>
88
<style>
99
body {
1010
margin: 0;

demo/viewer-prebuilt-from-npm-package.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>pdfjs-viewer-element | Viewer prebuilt from npm package demo</title>
7-
<script type="module" src="./../../dist/pdfjs-viewer-element.js"></script>
7+
<script type="module" src="https://cdn.skypack.dev/pdfjs-viewer-element"></script>
88
<style>
99
body {
1010
margin: 0;

image.webp

64.5 KB
Loading

0 commit comments

Comments
 (0)