0.0.17 • Published 2 years ago

node-printer-utility v0.0.17

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Node Printer utility for Electron/NodeJS Applications

Note

The package is still in Alpha testing. If you encounter any problems or dificulties running it, feel free to open an issue.

Development of this package

To be able to recompile this package, you will have to install wkhtmltox native package that can be found on this link.

Installation

npm install --save node-printer-utility

If your Electron and NodeJS NODE_MODULE version differs, you will have to rebuild this package with your Electron version using electron-rebuild after installing .

Usage

This package offers printing of a HTML string through conversion to PDF using native wkhtmltox package, and then printing using native CUPS package. If you wish to use printing capabilities of this package, you first have to call initSettings() method at the app startup, so the wkhtmltox initiates its configuration, and also be sure to to call deinitSettings() the application exit.

const { getDefaultPrinter } = require('node-printer-utility');

console.log(getDefaultPrinter());

Exported Methods

initSettings()
deinitSettings()
getDefaultPrinter()

Html prop is a HTML string that will be converted to the PDF and then printer. Be sure to use PDF safe CSS. PageHeight and PageWidth props are needed so that the PDF converter knows the dimensions of the page. PaperSize property is used for the CUPS package to set the MEDIA property. Success and Error props are callbacks used for additional JS work needed to be done after printing operation finishes. Success callback returns JobID integer, and error callback returns string message with some information about the error.

sendToPrinter(html, pageHeight, pageWidth, paper_size, success, error)
0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago