Electron.js Tutorial to Build PDF Documents Viewer Using Node.js electron-pdf-viewer GUI Desktop App in HTML5 & Javascript Full Project For Beginners

 

 

Electron pdf viewer

 

 

A node module for view pdf file in electron applications. Improve from origin project

 

screenshot

 

 

Install

 

 

npm i electron-pdf-viewer

 

 

Usage

 

 

app.js

 

 

var pdfview = require('electron-pdf-viewer');

//set pdf path
var pdfurl ='https://www.canon.com.cn/products/printer/pixma-fax/images/speedtest.pdf';  
// you can get full URL to display PDF by using getPdfHtmlURL() function
const displayPdfUrl = pdfview.getPdfHtmlURL(pdfurl);
const options = {
width: 800,
height: 600,
webPreferences: {
	nodeIntegration: false,
contextIsolation: true
  }
}
// If you dont provive options, default options will be use
var win = pdfview.showpdf(pdfurl, options);
win.show();

Leave a Reply