Socket
Book a DemoInstallSign in
Socket

node-printer

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-printer

Create and manage one or multiple printers (w/ CUPS), send file path or node buffer with support for all lp options. Get feedback on jobs you sent.

Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
916
31.23%
Maintainers
1
Weekly downloads
 
Created
Source

node-printer

Code Climate Build Status Test Coverage

A tool to print document or data. Based on "lp" binary.
Supports complete set of lp options (http://unixhelp.ed.ac.uk/CGI/man-cgi?lp)

Based on armetiz/node-printer-lp and diegoalberto/node-printer-lp-complete.

Quick Examples

var Printer = require('node-printer');
var options = {
    media: 'Custom.200x600mm',
    n: 3
};

// Get available printers list
Printer.list();

// Create a new Pinter from available devices
var printer = new Printer('EPSON_SX510');

// Print from a buffer, file path or text
var fileBuffer = fs.readFileSync('path/to/file');
var jobBuffer = printer.printBuffer(fileBuffer);

var filePath = 'package.json';
var jobFile = printer.printFile(filePath);

var text = 'Print text directly, when needed: e.g. barcode printers'
var jobText = printer.printText(text);

// Cancel a job
jobFile.cancel();

// Listen events from job
jobBuffer.once('sent', function() {
    jobBuffer.on('completed', function() {
        console.log('Job ' + jobBuffer.identifier + 'has been printed');
        jobBuffer.removeAllListeners();
    });
});

Roadmap

  • Rewrite option factories
  • Remove dependency to underscorejs
  • Write more tests
  • Find a way to emulate CUPS printers on Travis env

Keywords

printer

FAQs

Package last updated on 08 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts