Socket
Socket
Sign inDemoInstall

electron-pdf-window

Package Overview
Dependencies
26
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    electron-pdf-window

view PDF files in electron browser windows


Version published
Weekly downloads
671
increased by2.44%
Maintainers
1
Install size
5.88 MB
Created
Weekly downloads
 

Readme

Source

electron-pdf-window

view PDF files in electron browser windows. this module adds support for viewing PDF files in electron BrowserWindows. it works even if you navigate to a PDF file from a site, or opening a PDF file in a new window. a PDFWindow instance is just a subclass of BrowserWindow so it can be used just like it.

const { app } = require('electron')
const PDFWindow = require('electron-pdf-window')

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')
})

install

$ npm i electron-pdf-window

usage

win = new PDFWindow([opts])

win is an electron BrowserWindow that has support for viewing PDF files.

PDFWindow.addSupport(win)

adds PDF viewing support for win, which is a BrowserWindow instance.

using from the renderer process

Using the PDFWindow class directly from the renderer process is not recommended, because electron doesn't support proper extending of their built-in classes. In order to add PDF support from the renderer, use the addSupport method.

const { BrowserWindow } = require('electron').remote
const PDFWindow = require('electron-pdf-window')

const win = new BrowserWindow({ width: 800, height: 600 })

PDFWindow.addSupport(win)

win.loadURL('file:///a/b/c.pdf')

test

$ npm test

Keywords

FAQs

Last updated on 19 Sep 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc