qzprinty

v1.0.15
A simple utility to print html or pdf using qz tray
print html print pdf qz tray printing print from browser printing utility

Usage

Pass an HTML to the print function

let qzp = new qzPrinty();
qzp.print(htmlToPrint);

By default, the printer name in use is "Zebra-Technologies-ZTC-ZT230-200dpi-ZP" You can specify a printer name in options like so:

let qzp = new qzPrinty({ printer: "My printer name" });

You can also pass printer settings, for example:

let qzp = new qzPrinty({ 
    printer: 'qr-printer', 
    settings: { 
        units: 'in', 
        size: { 
            width: 4, 
            height: 6 
        }, 
        rasterize: false 
    } 
});

You can find all settings on the qz.io config page: https://qz.io/api/qz.configs

You can also print pdf files as such:

qzp.print(pathToPdf/URL, 'pdf');

To print multiple times, pass the values in an array, example:

qzp.print([html1, html2, html3]);
npm i qzprinty

Metadata

  • ISC
  • Whatever
  • Ammar Rayess
  • released 7/12/2020

Downloads

Maintainers