Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pdfjs-viewer-element

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pdfjs-viewer-element - npm Package Compare versions

Comparing version 2.6.2 to 2.6.3

27

dist/pdfjs-viewer-element.js

@@ -1,2 +0,2 @@

const w = (m, e) => new Promise((s) => {
const f = (m, e) => new Promise((s) => {
let r = e.querySelector(m);

@@ -33,5 +33,5 @@ if (r) {

n = null;
const p = s.leading ? r : o(this, l);
const w = s.leading ? r : o(this, l);
for (const y of t)
y(p);
y(w);
t = [];

@@ -58,3 +58,4 @@ }, e), u ? (r = o(this, l), h(r)) : t.push(h);

viewerExtraStyles: "",
viewerExtraStylesUrls: ""
viewerExtraStylesUrls: "",
nameddest: ""
}, d = {

@@ -66,6 +67,6 @@ AUTOMATIC: 0,

}, A = ["src", "viewer-path", "locale", "text-layer", "viewer-css-theme", "viewer-extra-styles", "viewer-extra-styles-urls"];
class f extends HTMLElement {
class p extends HTMLElement {
constructor() {
super(), this.onIframeReady = v(async (r) => {
await w("iframe", this.shadowRoot), r();
await f("iframe", this.shadowRoot), r();
}, 0, { leading: !0 }), this.setViewerExtraStyles = (r, n = "extra") => {

@@ -93,3 +94,3 @@ var i, a, o, l, h;

var n;
await w("iframe", this.shadowRoot), (n = this.iframe) == null || n.addEventListener("load", async () => {
await f("iframe", this.shadowRoot), (n = this.iframe) == null || n.addEventListener("load", async () => {
var t, i, a;

@@ -106,3 +107,3 @@ await ((i = (t = this.iframe.contentWindow) == null ? void 0 : t.PDFViewerApplication) == null ? void 0 : i.initializedPromise), r((a = this.iframe.contentWindow) == null ? void 0 : a.PDFViewerApplication);

static get observedAttributes() {
return ["src", "viewer-path", "locale", "page", "search", "phrase", "zoom", "pagemode", "text-layer", "viewer-css-theme", "viewer-extra-styles", "viewer-extra-styles-urls"];
return ["src", "viewer-path", "locale", "page", "search", "phrase", "zoom", "pagemode", "text-layer", "viewer-css-theme", "viewer-extra-styles", "viewer-extra-styles-urls", "nameddest"];
}

@@ -125,4 +126,4 @@ connectedCallback() {

getIframeSrc() {
const e = this.getFullPath(this.getAttribute("src") || c.src), s = this.getFullPath(this.getAttribute("viewer-path") || c.viewerPath), r = this.getAttribute("page") || c.page, n = this.getAttribute("search") || c.search, t = this.getAttribute("phrase") || c.phrase, i = this.getAttribute("zoom") || c.zoom, a = this.getAttribute("pagemode") || c.pagemode, o = this.getAttribute("locale") || c.locale, l = this.getAttribute("text-layer") || c.textLayer, h = this.getAttribute("viewer-css-theme") || c.viewerCssTheme, u = !!(this.getAttribute("viewer-extra-styles") || c.viewerExtraStyles);
return `${s}${c.viewerEntry}?file=${encodeURIComponent(e)}#page=${r}&zoom=${i}&pagemode=${a}&search=${n}&phrase=${t}&textLayer=${l}${o ? "&locale=" + o : ""}&viewerCssTheme=${h}&viewerExtraStyles=${u}`;
const e = this.getFullPath(this.getAttribute("src") || c.src), s = this.getFullPath(this.getAttribute("viewer-path") || c.viewerPath), r = this.getAttribute("page") || c.page, n = this.getAttribute("search") || c.search, t = this.getAttribute("phrase") || c.phrase, i = this.getAttribute("zoom") || c.zoom, a = this.getAttribute("pagemode") || c.pagemode, o = this.getAttribute("locale") || c.locale, l = this.getAttribute("text-layer") || c.textLayer, h = this.getAttribute("viewer-css-theme") || c.viewerCssTheme, u = !!(this.getAttribute("viewer-extra-styles") || c.viewerExtraStyles), w = this.getAttribute("nameddest") || c.nameddest;
return `${s}${c.viewerEntry}?file=${encodeURIComponent(e)}#page=${r}&zoom=${i}&pagemode=${a}&search=${n}&phrase=${t}&textLayer=${l}${o ? "&locale=" + o : ""}&viewerCssTheme=${h}&viewerExtraStyles=${u}&nameddest=${w}`;
}

@@ -153,8 +154,8 @@ mountViewer(e) {

}
window.customElements.get("pdfjs-viewer-element") || (window.PdfjsViewerElement = f, window.customElements.define("pdfjs-viewer-element", f));
window.customElements.get("pdfjs-viewer-element") || (window.PdfjsViewerElement = p, window.customElements.define("pdfjs-viewer-element", p));
export {
f as PdfjsViewerElement,
p as PdfjsViewerElement,
d as ViewerCssTheme,
f as default,
p as default,
A as hardRefreshAttributes
};
{
"name": "pdfjs-viewer-element",
"version": "2.6.2",
"version": "2.6.3",
"license": "MIT",

@@ -5,0 +5,0 @@ "author": {

@@ -10,3 +10,4 @@ <p align="center">

See [examples](https://alekswebnet.github.io/pdfjs-viewer-element/#demo) of usage in Vue, React, Svelte, or simple HTML pages.
See [demo pages](https://github.com/alekswebnet/pdfjs-viewer-element/tree/master/demo) for various usecases.
See [live examples](https://alekswebnet.github.io/pdfjs-viewer-element/#demo) of usage with frameworks.

@@ -38,6 +39,8 @@ ⚠️ `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.

[API](https://alekswebnet.github.io/pdfjs-viewer-element/#api)
[API playground](https://alekswebnet.github.io/pdfjs-viewer-element/#api)
[Live examples](https://alekswebnet.github.io/pdfjs-viewer-element/#demo)
[Demo pages](https://github.com/alekswebnet/pdfjs-viewer-element/tree/master/demo)
## Install

@@ -84,2 +87,4 @@

`nameddest` - Go to a named destination
`search` - Search text

@@ -97,2 +102,4 @@

`viewer-extra-styles-urls` - Add external CSS files to the viewer application
Play with attributes on [Api docs page](https://alekswebnet.github.io/pdfjs-viewer-element/#api).

@@ -121,6 +128,28 @@

viewer-extra-styles="#toolbarViewerMiddle { display: none; }"
viewer-extra-styles-urls="['/demo/extra-styles-one.css', '/demo/extra-styles-two.css']">
viewer-extra-styles-urls="['/demo/viewer-custom-theme.css']">
</pdfjs-viewer-element>
```
Build your own theme with viewer's custom variables and `viewer-extra-styles-urls` attribute:
```css
:root {
--main-color: #5755FE;
--toolbar-icon-bg-color: #0200a8;
--field-color: #5755FE;
--separator-color: #5755FE;
--toolbar-border-color: #5755FE;
--field-border-color: #5755FE;
--toolbar-bg-color: rgba(139, 147, 255, .1);
--body-bg-color: rgba(255, 247, 252, .7);
--button-hover-color: rgba(139, 147, 255, .1);
--toolbar-icon-hover-bg-color: #0200a8;
--toggled-btn-color: #0200a8;
--toggled-btn-bg-color: rgba(139, 147, 255, .1);
--toggled-hover-active-btn-color: #5755FE;
--doorhanger-hover-bg-color: rgba(139, 147, 255, .1);
--doorhanger-hover-color: #0200a8;
--dropdown-btn-bg-color: rgba(139, 147, 255, .1);
}
```
## PDF.js Viewer Application

@@ -127,0 +156,0 @@

@@ -46,7 +46,2 @@ export declare const ViewerCssTheme: {

}
export interface PdfjsViewerLoadedEvent extends Event {
detail: {
source: PdfjsViewerElementIframeWindow;
};
}
export default PdfjsViewerElement;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc