JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 460
  • Score
    100M100P100Q104500F
  • License MIT

Create a printer on the network

Package Exports

  • ipp-printer

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ipp-printer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ipp-printer

An IPP printer written in Node.js.

This is work in progress!

Build status js-standard-style

Installation

npm install ipp-printer

Usage

var Printer = require('ipp-printer')

var printer = new Printer('My Printer')

printer.on('job', function (job) {
  fs.writeFile('job.ps', job.data)
})

API

new Printer([options])

The Printer object can be initialized with either the printer name as a string or an object containing:

  • name - Optional name of the printer (defaults to Node JS)
  • port - Optional port the printer should listen on (defaults to a random available port)

Event: job

function (job) {}

Emitted each time a new job is ready. The actual document data will be available via job.data.

Job object example:

{
  id: 1,
  state: 9,
  data: <Buffer 25 21 50 ...>,
  attributes: [
    { tag: 69, name: 'job-printer-uri', value: 'ipp://watson.local.:3000/' },
    { tag: 69, name: 'job-uri', value: 'ipp://watson.local.:3000/1' },
    { tag: 66, name: 'job-name', value: 'My Document Title' },
    { tag: 66, name: 'job-originating-user-name', value: 'watson' },
    { tag: 68, name: 'job-state-reasons', value: 'none' },
    { tag: 33, name: 'time-at-creation', value: 40 },
    { tag: 71, name: 'attributes-charset', value: 'utf-8' },
    { tag: 72, name: 'attributes-natural-language', value: 'en-us' }
  ],
  processingAt: 1447830263340,
  completedAt: 1447830263340
}

See the ipp-encoder for an explanation of the tag values.

Event: request

function (request) {}

Emitted each time a new IPP request is received. The request body is available via request.body.

printer.name

The printer name.

printer.port

The port of the printer is listening on.

printer.jobs

An array of all jobs handled by the printer.

printer.server

An instance of http.Server.

License

MIT