0.1.0-alpha.1 • Published 6 years ago
electron-print-dialog
Licence
MIT
Version
0.1.0-alpha.1
Deps
0
Size
9 kB
Vulns
0
Weekly
0
electron-print-dialog
A library to add a print dialog to your Electron app
Install
$ npm install --save electron-print-dialog
Usage
// Make sure to excute the function to initialize a printDialog
const printDialog = require('electron-print-dialog')();
let window;
app.on('ready', function() {
// Create the parent window
window = new BrowserWindow({});
// Attach print listeners to the window
printDialog.attach(window);
});
// manually open the print dialog
// useful if you have a api request that returns a link to a document and you would like to print it.
printDialog.open(window, {
data:
'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf'
});
API
printDialog.attach(window) *Not Implemented
Add print listeners to the given BrowserWindow to override the default print behavior.
printDialog.open(window, options)
Open the print dialog for the given window and print listeners to the given BrowserWindow.
windowBrowserWindow (required)- The window to use as the parent window for the print dialog.optionsObject (optional)data(Uint8Array | String)(optional) - PDF data or a url to print. Supports urls to html, pdf, or png. If not provided the windows webContents will be used instead.