electron-pdf-window
view PDF files in electron browser windows. this module adds support for viewing
PDF files in electron BrowserWindow
s.
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 =const PDFWindow =app
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 = remoteconst PDFWindow =const win = width: 800 height: 600PDFWindowwin
test
$ npm test