# electron-vue-printer

> An electron-vue plugin, silent print pictures。electron-vue可静默打印图片插件。

Latest version **1.3.3** (published 2020-09-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install electron-vue-printer
pnpm add electron-vue-printer
yarn add electron-vue-printer
bun add electron-vue-printer
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.3 |
| Published | 2020-09-03 |
| First published | 2020-08-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 55 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | 'Imfdj' |
| Maintainers | imfdj |
| Keywords | electron, vue, silent, printer, print, image |

## Links

- npm: https://www.npmjs.com/package/electron-vue-printer
- Repository: https://github.com/Imfdj/electron-vue-printer
- Homepage: https://github.com/Imfdj/electron-vue-printer#readme
- Issues: https://github.com/Imfdj/electron-vue-printer/issues
- npm.io page: https://npm.io/package/electron-vue-printer

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.3.3 (latest) — 2020-09-03
- 1.3.2 — 2020-09-03
- 1.3.1 — 2020-08-26
- 1.3.0 — 2020-08-26
- 1.2.0 — 2020-08-25
- 1.1.0 — 2020-08-25
- 1.0.0 — 2020-08-24

## README

<h1 align="center">
   <img alt="Logo" width="166" src="https://cdn.pixabay.com/photo/2017/06/10/07/29/printer-2389244_960_720.png"/>
</h1>
<h1 align="center">
   electron-vue-printer
</h1>

<h3 align="center">
    electron-vue 打印图片插件。使用非常简单，可静默打印图片。
</h3>
<h3 align="center">
 	Simple and easy silent print pictures for electron-vue plugin.
</h3>

 <p align="center">
     <a href="https://choosealicense.com/licenses/mit/"><img
         alt="License MIT"
         src="https://img.shields.io/badge/licence-MIT-blue.svg?style=flat-square"></a>
     <img alt="No dependencies"
         src="https://img.shields.io/badge/dependencies-none-3387e0.svg?style=flat-square">
     <img alt="Current version"
             src="https://img.shields.io/badge/build-passing-brightgreen">
     <img alt="Current version"
             src="https://img.shields.io/badge/version-1.0.0-brightgreen">
 </p>

### Features
* Silent print
* Ultra small
* Simple usage
* No other dependencies

### Hint
* Version number: v3.1.13、 v7.3.2、 v8.5.0、 v9.2.1 perfectly usable.The corresponding minor version number should be the same.
* Version number: v5.0.13、 v6.1.12 is available, but only the default printer can be used.The corresponding minor version number should be the same.
* Version v4 has various problems, so support is dropped.

#### Installation

``` bash
npm install electron-vue-printer -S
or
yarn add electron-vue-printer -S
```
#### Usage

``` bash
index.vue -->
<template>
  <div class="index">
    <electron-vue-printer
      ref="electronVuePrinter"
      :silent="false"
      @webview-ready="webviewReady"
    ></electron-vue-printer>
  </div>
</template>

<script>
  import electronVuePrinter from 'electron-vue-printer'

  export default {
    name: "index",
    components: {
      electronVuePrinter
    },
    methods: {
      webviewReady() {
        this.$refs.electronVuePrinter.print('https://cdn.pixabay.com/photo/2017/06/10/07/29/printer-2389244_960_720.png');
      },
    },
  }
</script>
```
| Configuration | Type  |Default| Description
| ------------- | ----- | ----- | ----------- |
| `options`    | object |       | `options.offsetX: number. Left the offset,default 0.` |
|              |        |       | `options.offsetY: number. Top the offset,default 0.` |
|              |        |       | `options.imageWidth: number. Width of picture.` |
|              |        |       | `options.imageHeight: number. Height of picture.` |
| `rotateType` | number |   0   | `Image rotation direction. 0: normal;1: Clockwise;2: Counterclockwise;3: Upside down.` |
| `imgStyle`   | string |       | `Customize image styles.Width and height can override options.imageWidth and options.imageHeight.Transform will cause rotateType to become invalid.` |
| `show`       | boolean| false | `Whether to display preview.For debugging.` |
| `silent`     | boolean| false | `Whether to enable silent printing.` |


| Events            | Description
| -------------- | ----------- |
| `dom-ready(webview)`  | `The webview for the user to render the printed content is ready,And return the dom of the webview.` |
| `get-printer-list(data: Array)`  | `Return printer list data.Maybe setPrinterName method can use it.` |
| `webview-render-begin`  | `Print content starts to render.` |
| `webview-render-finish`  | `The printed content is rendered.` |
| `start-printing(state: Boolean)`  | `Start printing, and return whether to start printing normally.` |

### Methods
* print(`[src,base64]:String`) _- Set print picture src(The absolute path of the local picture or the address of the online picture) or base64 to trigger print automatically._
* setPrinterName(`name:String, callBack(err)`) _- Set the printer device name.If you don't want to use the default printer, you can use it.If err in callBack is not empty, it means the setting failed._

## License

[MIT](LICENSE)

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