easypdf
Version:
A simple library that use PDF.js for rendering pdf file on electron
25 lines (20 loc) • 702 B
JavaScript
let easypdf = require('../../src/index.js');
let path = require('path');
let pdf_file_remote = 'http://ricardogeek.com/docs/r_clean_code.pdf';
// pdf file
let pdfFile = easypdf(pdf_file_remote);
// set the container
let pdfContainerRemote = pdfFile.setContainer('#pdf-file');
// render the pdf
pdfContainerRemote.render();
// add the event
pdfContainerRemote.on('firstLoad', function() {
console.log("Loaded !");
});
pdfContainerRemote.on('pageNumberChanged', function(new_page) {
console.log("Current page number: " + new_page);
});
// this event is not one of the EasyPDF event
pdfContainerRemote.on('mousemove', function(e) {
console.log(`mouse position: (${e.pageX}, ${e.pageY})`);
});