# electron-print-dialog

> Add a print dialog in your electron app.

Latest version **0.1.0-alpha.1** (published 2020-03-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install electron-print-dialog
pnpm add electron-print-dialog
yarn add electron-print-dialog
bun add electron-print-dialog
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0-alpha.1 |
| Published | 2020-03-30 |
| First published | 2020-03-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 0 |
| Unpacked size | 9.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Aaron Holland |
| Maintainers | aaronholla |
| Keywords | electron, print, printing, dialog, react, preview, chrome |

## Links

- npm: https://www.npmjs.com/package/electron-print-dialog
- npm.io page: https://npm.io/package/electron-print-dialog

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.0-alpha.1 (latest) — 2020-03-30
- 0.1.0-alpha.2 (next) — 2020-03-30

## README

# electron-print-dialog

> A library to add a print dialog to your [Electron](https://electronjs.org) app

## Install

```
$ npm install --save electron-print-dialog
```

## Usage

```js
// 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](https://github.com/electron/electron/blob/master/docs/api/browser-window.md) (**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.

---
_Source: https://npm.io/package/electron-print-dialog · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
