electron-print-dialog

0.1.0-alpha.1 • Public • Published

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.

  • window BrowserWindow (required)- The window to use as the parent window for the print dialog.

  • options Object (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.

Package Sidebar

Install

npm i electron-print-dialog

Weekly Downloads

2

Version

0.1.0-alpha.1

License

MIT

Unpacked Size

9.6 kB

Total Files

7

Last publish

Collaborators

  • aaronholla