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

electron-pdf-window-s

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-pdf-window-s

View pdf in new browser windows.

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
Maintainers
1
Weekly downloads
 
Created
Source

electron-pdf-window-s

View pdf in new browser windows.

npm npm type definitions GitHub

English | 简体中文

Install

Use npm or yarn:

# Use npm
npm install electron-pdf-window-s -D

# Use yarn
yarn add electron-pdf-window-s -D

Usage

A simple example:

const { app } = require('electron')

// Use defualt export so you could get intelligent completion
const PDFWindow = require('electron-pdf-window-s').default

app.on('ready', () => {
  const win = new PDFWindow({
    width: 800,
    height: 600
  })

  win.loadURL('http://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf')
})

You will see pdf window is show.

new PDFWindow(options)

Create a pdf window instance. The option is same as BrowserWindow's option.

Then, you could use loadURL() to load a PDF file or url.

PDFWindow.viewerPath

Static property, specifies path for the pdfjs viewer.

Default is path.join(__dirname, '../viewer/web/viewer.html')

PDFWindow.addSupport(browserWindow)

Static method, enable normal BrowserWindow to support loading pdf by loadURL().

About electron-pdf-window

Special thanks to @gerhardberger. This project is based on his electron-pdf-window. But unfortunately, that library no longer seems to be maintained. So I froked it and created new one.

Differences between them

  • Version of pdfjs viewer
  • No listeners of will-navigate and new-window events anymore.
  • Typescript support

Electron Support

At least >=8.0.0 version.

About PDFJS Viewer

Website: http://mozilla.github.io/pdf.js/

Version: Stable(v2.13.216)

Options wiki: Viewer options · mozilla/pdf.js Wiki

Changes in this library:

  • Remove exmpale pdf file.
  • Remove cross origin limit(Delete validateFileURL() function in viewer.js).

Support signature?

Now is unknown

We have modify some code to support signature feature. But we didn't do that in the latest version.

LICENSE

MIT LICENSE

Keywords

FAQs

Package last updated on 13 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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