Giter Club home page Giter Club logo

ipp-printer's Introduction

ipp-printer

Create a printer on your network using nothing but Node.js. This module implements version 1.1 of the IPP protocol and uses Bonjour/Zeroconf to advertise a printer on your local network that anyone can print to.

For a video introduction, check out the talk I gave at Node.js Interactive 2015 in Portland.

ipp-printer

Build status js-standard-style

Project Status

This module have been confirmed to work with both OS X and Windows clients. But if you experience any problems please don't hesitate to open an issue.

Be aware that this module currently doesn't support any of the security features build into IPP, so don't print anything you don't want others to know on an open network.

Installation

Install globally to use CLI:

npm install ipp-printer -g

Or install locally to use in your project:

npm install ipp-printer --save

CLI Usage

Just run:

$ ipp-printer

The printer will now advertise it self on the network using Bonjour/Zeroconf and write all jobs to the current working directory.

Programmatic Usage

var fs = require('fs')
var Printer = require('ipp-printer')

var printer = new Printer('My Printer')

printer.on('job', function (job) {
  console.log('[job %d] Printing document: %s', job.id, job.name)

  var filename = 'job-' + job.id + '.ps' // .ps = PostScript
  var file = fs.createWriteStream(filename)

  job.on('end', function () {
    console.log('[job %d] Document saved as %s', job.id, filename)
  })

  job.pipe(file)
})

API

Class: Printer

new Printer([options])

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

  • name - Name of the printer (default: Node JS)
  • port - Port the printer should listen on (defaults to a random available port)
  • zeroconf - Boolean. If true, the printer will advertise it self on the network using Bonjour/Zeroconf for easier setup (default: true)
  • fallback - Boolean. If true, responses to IPP/1.0 requests will identify them selfs as coming from an IPP/1.0 server. This shouldn't be necessary in a perfect world, but some versions of Windows doesn't like connecting to a server running a different version of the IPP protocol than it self (default: true)

Note that the IPP standard specifies port 631 as the default IPP port, but most IPP clients are fine with connecting to another port.

Event: job

function (job) {}

Emitted each time a new job is sent to the printer. The job is an instance of the Job class.

Example writing a print job document to a file:

printer.on('job', function (job) {
  var filename = 'job-' + job.id + '.ps' // expect Postscript
  var file = fs.createWriteStream(filename)
  job.on('end', function () {
    console.log('written job to', filename)
  })
  job.pipe(file)
})

Event: operation

function (operation) {}

Emitted each time a new IPP operation is received. This event is more low level than the job event as it will be emitted on all incoming IPP operations.

This module currently supports the minimum set of operations required by the IPP standard:

  • print-job (0x02)
  • validate-job (0x04)
  • cancel-job (0x08)
  • get-job-attribtes (0x09)
  • get-jobs (0x0a)
  • get-printer-attributes (0x0b)

The operation object have the following properties supplied by the printer client:

  • version - An object containing the major and minor IPP version of the request (e.g. { major: 1, minor: 1 })
  • operationId - The id of the IPP operation
  • requestId - The id of the IPP request
  • groups - An array of IPP attribute groups

See the ipp-encoder for an explanation of the different operation types.

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.

Class: Job

A job is a readable stream containing the document to be printed. In many cases this will be in Postscript format.

Event: cancel

function () {}

Emitted if the job is cancelled prior to completion.

Event: abort

function () {}

Emitted if the job is aborted prior to completion.

Event: error

function (error) {}

Emitted if the job encounters an error.

job.id

The id of the job.

job.state

The job state.

See the ipp-encoder for an explanation of the job states.

job.uri

The job URI.

job.name

The document name.

job.userName

The name of the requesting user.

job.attributes([filter])

Returns an array of job attributes.

If an array of attribute names or attribute groups is given as the first argument, the returned array will only include the attributes maching the supplied names or groups.

Attributes example:

[
  { tag: 0x45, name: 'job-printer-uri', value: 'ipp://watson.local.:3000/' },
  { tag: 0x45, name: 'job-uri', value: 'ipp://watson.local.:3000/1' },
  { tag: 0x42, name: 'job-name', value: 'My Document Title' },
  { tag: 0x42, name: 'job-originating-user-name', value: 'watson' },
  { tag: 0x44, name: 'job-state-reasons', value: 'none' },
  { tag: 0x21, name: 'time-at-creation', value: 40 },
  { tag: 0x47, name: 'attributes-charset', value: 'utf-8' },
  { tag: 0x48, name: 'attributes-natural-language', value: 'en-us' }
]

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

Debugging

To see the communication between the client and the server, enable debugging mode by setting the environment variable DEBUG=ipp-printer.

If you open an issue because the module crashes or if the client cannot communicate properly with the printer it helps a lot if you attach the client/server communication to the issue.

License

MIT

ipp-printer's People

Contributors

dominictarr avatar watson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ipp-printer's Issues

Removing/disabling printer after initialized

Thanks for this awesome module.

I wanted to know if there's any way to stop the printing server after it's been initialized.
I am trying to create a preferences panel for my application where the user can toggle bonjour/zeroconf discovery on or off, and changing a port, or optionally disabling the printer features altogether.

If I try to initialize the printer again, I get an EADDRINUSE error. and I have tried to stop the printer by calling printer.stop or printer.server.stop, or removing the reference to the printer variable and it doesn't seem to work.

Is there any non documented API feature to accomplish this?

Thanks in advance

Printer authentication

Is this supported? Is it at the HTTP level? This would be awesome to identify people printing and just do loads of funny stuff ๐Ÿ˜„

No debug, and struggling to get this working

Has anyone had this library working recently?

I've been trying with the example code in the README, but although the IPP printer is advertised, no print jobs can be submitted. I'm also getting a blank stdout, even when setting the debug environment variable, so it's tricky to debug!

Would appreciate any suggestions from those who have this working :-)

[SUGGESTION] Docker image

I know this isn't an issue but would be pretty useful to create a Dockerfile (Docker image) to quickly spin up the project and be able to test Printing functionalities in any project.

Adding printer in Windows kills my print server

Wrote an app around ipp-printer, automaticgiant/node-jsprinter, that dies when you add the printer to Windows. I think it's a problem with ipp-printer. I'll add more later probably, but here's the initial report.

$ jsprinter
started with printer at ipp://localhost:40023/printers/jsprinter and joblist at http://localhost:40024
C:\Users\Kelli\AppData\Roaming\npm\node_modules\jsprinter\node_modules\ipp-printer\lib\groups.js:67
    .filter(function (name) {
    ^

TypeError: Cannot read property 'filter' of undefined
    at unsupportedAttributes (C:\Users\Kelli\AppData\Roaming\npm\node_modules\jsprinter\node_modules\ipp-printer\lib\groups.js:67:5)
    at Object.unsupportedAttributesTagPrinter (C:\Users\Kelli\AppData\Roaming\npm\node_modules\jsprinter\node_modules\ipp-printer\lib\groups.js:41:17)
    at Object.getPrinterAttributes (C:\Users\Kelli\AppData\Roaming\npm\node_modules\jsprinter\node_modules\ipp-printer\lib\operations.js:34:12)
    at router (C:\Users\Kelli\AppData\Roaming\npm\node_modules\jsprinter\node_modules\ipp-printer\index.js:132:54)
    at IncomingMessage.consumeAttrGroups (C:\Users\Kelli\AppData\Roaming\npm\node_modules\jsprinter\node_modules\ipp-printer\index.js:83:7)
    at emitOne (events.js:77:13)
    at IncomingMessage.emit (events.js:169:7)
    at IncomingMessage.Readable.read (_stream_readable.js:360:10)
    at flow (_stream_readable.js:743:26)
    at resume_ (_stream_readable.js:723:3)

ipp-server does not respont on a job

Hey all, dear Thomas,

Really cool this project.
I copied the code to try the application. So I can add the printer as a Microsoft Printing device. The Driver I choose was the HP Color LaserJet 2500 PS Class Driver.
It seems like there is a problem with the job event. The operations look fine but if I send a job the ipp-printer software does not respond. Have you any idea what to change?

best

anton

'use strict';
var dhttp  = require('debug')('http')
  , dprint = require('debug')('printer');

var fs = require('fs');

var nonPrivate = require('non-private-ip');
var url = require('url');
var ip = nonPrivate() || nonPrivate.private();

var Printer = require('ipp-server');
var config = require('rc')('ipp-server', {
  name: 'printer__12345', dir: __dirname+'/output', port: 9100
});
var p = new Printer(config)

p.on('job', function (job) {
    dprint(job);

    job.on('end', function(){
	dbrint('job id: %d', job.id);
    });

    job.pipe(process.stdout);
});

p.on('operation', function (operation) {
    dprint(operation);
});

p.server.on('listening', function () {
    dhttp('ipp-printer listening on:', url.format({protocol: 'http', hostname: ip, port: config.port}));
});

dprint(p);
PS U:\projekte\ipp_pdf_printer> $env:DEBUG='*';node index.js
  printer Printer {
  printer   _events: { job: [Function], operation: [Function] },
  printer   _eventsCount: 2,
  printer   _maxListeners: undefined,
  printer   _jobId: 0,
  printer   _zeroconf: true,
  printer   bonjour:
  printer    Bonjour {
  printer      _server: Server { mdns: [EventEmitter], registry: {} },
  printer      _registry: Registry { _server: [Server], _services: [] } },
  printer   jobs: [],
  printer   started: 1541001630903,
  printer   state: undefined,
  printer   name: 'printer__12345',
  printer   port: 9100,
  printer   uri: undefined,
  printer   server:
  printer    Server {
  printer      _events:
  printer       { request: [Function: onrequest],
  printer         connection: [Function: connectionListener],
  printer         listening: [Array] },
  printer      _eventsCount: 3,
  printer      _maxListeners: undefined,
  printer      _connections: 0,
  printer      _handle:
  printer       TCP {
  printer         reading: false,
  printer         onread: null,
  printer         onconnection: [Function: onconnection],
  printer         [Symbol(owner)]: [Circular] },
  printer      _usingWorkers: false,
  printer      _workers: [],
  printer      _unref: false,
  printer      allowHalfOpen: true,
  printer      pauseOnConnect: false,
  printer      httpAllowHalfOpen: false,
  printer      timeout: 120000,
  printer      keepAliveTimeout: 5000,
  printer      _pendingResponseData: 0,
  printer      maxHeadersCount: null,
  printer      _connectionKey: '6::::9100',
  printer      [Symbol(IncomingMessage)]: { [Function: IncomingMessage] super_: [Function] },
  printer      [Symbol(ServerResponse)]: { [Function: ServerResponse] super_: [Function] },
  printer      [Symbol(asyncId)]: 9 },
  printer   fallback: true,
  printer   authorize: true,
  printer   host: 'IT-DELLM4700',
  printer   queues: {} } +0ms
  ipp-server printer "printer__12345" is listening on ipp://IT-DELLM4700:9100/ +0ms
  ipp-server printer "printer__12345" changed state to idle +2ms
  ipp-server advertising printer "printer__12345" on network on port 9100 +2ms
  http ipp-printer listening on: http://193.99.163.171:9100 +0ms
  ipp-server HTTP request: POST / +46s
  printer { version: { major: 1, minor: 0 },
  printer   groups: [ { tag: 1, attributes: [Array] } ],
  printer   requestId: 11,
  printer   operationId: 11 } +46s
  ipp-server IPP/1.0 operation 11 (request #11) [ { tag: 1,
    attributes:
     [ { tag: 71, name: 'attributes-charset', value: [ 'utf-8' ] },
       { tag: 72,
         name: 'attributes-natural-language',
         value: [ 'en-us' ] },
       { tag: 69,
         name: 'printer-uri',
         value: [ 'http://193.99.163.171:9100' ] } ] } ] +4ms
  ipp-server responding to request #11 { version: { major: 1, minor: 0 },
  statusCode: 0,
  requestId: 11,
  groups:
   [ { tag: 1,
       attributes:
        [ { tag: 71, name: 'attributes-charset', value: 'utf-8' },
          { tag: 72, name: 'attributes-natural-language', value: 'en-us' },
          { tag: 53,
            name: 'status-message',
            value: { lang: 'en-us', value: 'successful-ok' } } ] },
     { tag: 5,
       attributes: [ { tag: 16, name: 'all', value: 'unsupported' } ] },
     { tag: 4,
       attributes:
        [ { tag: 69,
            name: 'printer-uri-supported',
            value: 'ipp://IT-DELLM4700:9100/' },
          { tag: 68, name: 'uri-security-supported', value: 'none' },
          { tag: 68,
            name: 'uri-authentication-supported',
            value: 'digest' },
          { tag: 54,
            name: 'printer-name',
            value: { lang: 'en-us', value: 'printer__12345' } },
          { tag: 35, name: 'printer-state', value: 3 },
          { tag: 68, name: 'printer-state-reasons', value: 'none' },
          { tag: 68, name: 'ipp-versions-supported', value: '1.1' },
          { tag: 35,
            name: 'operations-supported',
            value: [ 2, 4, 10, 11, 8, 9 ] },
          { tag: 71, name: 'charset-configured', value: 'utf-8' },
          { tag: 71, name: 'charset-supported', value: 'utf-8' },
          { tag: 72, name: 'natural-language-configured', value: 'en-us' },
          { tag: 72,
            name: 'generated-natural-language-supported',
            value: 'en-us' },
          { tag: 73,
            name: 'document-format-default',
            value: 'application/postscript' },
          { tag: 73,
            name: 'document-format-supported',
            value:
             [ 'text/html',
               'text/plain',
               'application/vnd.hp-PCL',
               'application/octet-stream',
               'application/pdf',
               'application/postscript' ] },
          { tag: 34, name: 'printer-is-accepting-jobs', value: true },
          { tag: 33, name: 'queued-job-count', value: 0 },
          { tag: 68,
            name: 'pdl-override-supported',
            value: 'not-attempted' },
          { tag: 33, name: 'printer-up-time', value: 46 },
          { tag: 49,
            name: 'printer-current-time',
            value: 2018-10-31T16:01:17.071Z },
          { tag: 68,
            name: 'compression-supported',
            value: [ 'deflate', 'gzip' ] } ] } ] } +3ms
  ipp-server HTTP request: POST / +33ms
  printer { version: { major: 1, minor: 0 },
  printer   groups: [ { tag: 1, attributes: [Array] } ],
  printer   requestId: 11,
  printer   operationId: 11 } +39ms
  ipp-server IPP/1.0 operation 11 (request #11) [ { tag: 1,
    attributes:
     [ { tag: 71, name: 'attributes-charset', value: [ 'utf-8' ] },
       { tag: 72,
         name: 'attributes-natural-language',
         value: [ 'en-us' ] },
       { tag: 69,
         name: 'printer-uri',
         value: [ 'http://193.99.163.171:9100' ] } ] } ] +5ms
  ipp-server responding to request #11 { version: { major: 1, minor: 0 },
  statusCode: 0,
  requestId: 11,
  groups:
   [ { tag: 1,
       attributes:
        [ { tag: 71, name: 'attributes-charset', value: 'utf-8' },
          { tag: 72, name: 'attributes-natural-language', value: 'en-us' },
          { tag: 53,
            name: 'status-message',
            value: { lang: 'en-us', value: 'successful-ok' } } ] },
     { tag: 5,
       attributes: [ { tag: 16, name: 'all', value: 'unsupported' } ] },
     { tag: 4,
       attributes:
        [ { tag: 69,
            name: 'printer-uri-supported',
            value: 'ipp://IT-DELLM4700:9100/' },
          { tag: 68, name: 'uri-security-supported', value: 'none' },
          { tag: 68,
            name: 'uri-authentication-supported',
            value: 'digest' },
          { tag: 54,
            name: 'printer-name',
            value: { lang: 'en-us', value: 'printer__12345' } },
          { tag: 35, name: 'printer-state', value: 3 },
          { tag: 68, name: 'printer-state-reasons', value: 'none' },
          { tag: 68, name: 'ipp-versions-supported', value: '1.1' },
          { tag: 35,
            name: 'operations-supported',
            value: [ 2, 4, 10, 11, 8, 9 ] },
          { tag: 71, name: 'charset-configured', value: 'utf-8' },
          { tag: 71, name: 'charset-supported', value: 'utf-8' },
          { tag: 72, name: 'natural-language-configured', value: 'en-us' },
          { tag: 72,
            name: 'generated-natural-language-supported',
            value: 'en-us' },
          { tag: 73,
            name: 'document-format-default',
            value: 'application/postscript' },
          { tag: 73,
            name: 'document-format-supported',
            value:
             [ 'text/html',
               'text/plain',
               'application/vnd.hp-PCL',
               'application/octet-stream',
               'application/pdf',
               'application/postscript' ] },
          { tag: 34, name: 'printer-is-accepting-jobs', value: true },
          { tag: 33, name: 'queued-job-count', value: 0 },
          { tag: 68,
            name: 'pdl-override-supported',
            value: 'not-attempted' },
          { tag: 33, name: 'printer-up-time', value: 46 },
          { tag: 49,
            name: 'printer-current-time',
            value: 2018-10-31T16:01:17.113Z },
          { tag: 68,
            name: 'compression-supported',
            value: [ 'deflate', 'gzip' ] } ] } ] } +2m

Document Remains in Queue After Printing

Issue Details
Printed pages remain in the queue after the file has been saved

image

Also, if I right-click > Cancel, I get the message: "Error Processing Command"

System Details

  • Windows 10 Pro Version 1803 (OS Build 17134.285) / 64-bit
  • Node 8.11.1
  • NPM 5.6.0

Debug Log - Attempt to Cancel

  ipp-printer IPP/1.0 operation 8 (request #8) [ { tag: 1,
    attributes:
     [ { tag: 71, name: 'attributes-charset', value: [ 'utf-8' ] },
       { tag: 72,
         name: 'attributes-natural-language',
         value: [ 'en-us' ] },
       { tag: 69,
         name: 'printer-uri',
         value: [ 'http://localhost:3000' ] },
       { tag: 33, name: 'job-id', value: [ 1 ] },
       { tag: 66,
         name: 'requesting-user-name',
         value: [ 'daniel.breen' ] } ] } ] +3ms
  ipp-printer responding to request #8 { version: { major: 1, minor: 0 },
  statusCode: 1030,
  requestId: 8,
  groups:
   [ { tag: 1,
       attributes:
        [ { tag: 71, name: 'attributes-charset', value: 'utf-8' },
          { tag: 72, name: 'attributes-natural-language', value: 'en-us' },
          { tag: 53,
            name: 'status-message',
            value: { lang: 'en-us', value: 'client-error-not-found' } } ] } ] } +1ms

Debug Log - Printed Test Page

Printer created
  ipp-printer printer "Local Test" is listening on ipp://DESKTOP-RJMKARL:3000/ +0ms
  ipp-printer printer "Local Test" changed state to idle +1ms
  ipp-printer advertising printer "Local Test" on network on port 3000 +0ms
  ipp-printer HTTP request: POST / +4s
  ipp-printer IPP/1.0 operation 11 (request #11) [ { tag: 1,
    attributes:
     [ { tag: 71, name: 'attributes-charset', value: [ 'utf-8' ] },
       { tag: 72,
         name: 'attributes-natural-language',
         value: [ 'en-us' ] },
       { tag: 69,
         name: 'printer-uri',
         value: [ 'http://localhost:3000' ] } ] } ] +3ms
  ipp-printer responding to request #11 { version: { major: 1, minor: 0 },
  statusCode: 0,
  requestId: 11,
  groups:
   [ { tag: 1,
       attributes:
        [ { tag: 71, name: 'attributes-charset', value: 'utf-8' },
          { tag: 72, name: 'attributes-natural-language', value: 'en-us' },
          { tag: 53,
            name: 'status-message',
            value: { lang: 'en-us', value: 'successful-ok' } } ] },
     { tag: 5,
       attributes: [ { tag: 16, name: 'all', value: 'unsupported' } ] },
     { tag: 4,
       attributes:
        [ { tag: 69,
            name: 'printer-uri-supported',
            value: 'ipp://DESKTOP-RJMKARL:3000/' },
          { tag: 68, name: 'uri-security-supported', value: 'none' },
          { tag: 68, name: 'uri-authentication-supported', value: 'none' },
          { tag: 54,
            name: 'printer-name',
            value: { lang: 'en-us', value: 'Local Test' } },
          { tag: 35, name: 'printer-state', value: 3 },
          { tag: 68, name: 'printer-state-reasons', value: 'none' },
          { tag: 68, name: 'ipp-versions-supported', value: '1.1' },
          { tag: 35,
            name: 'operations-supported',
            value: [ 2, 4, 10, 11, 8, 9 ] },
          { tag: 71, name: 'charset-configured', value: 'utf-8' },
          { tag: 71, name: 'charset-supported', value: 'utf-8' },
          { tag: 72, name: 'natural-language-configured', value: 'en-us' },
          { tag: 72,
            name: 'generated-natural-language-supported',
            value: 'en-us' },
          { tag: 73,
            name: 'document-format-default',
            value: 'application/postscript' },
          { tag: 73,
            name: 'document-format-supported',
            value:
             [ 'text/html',
               'text/plain',
               'application/vnd.hp-PCL',
               'application/octet-stream',
               'application/pdf',
               'application/postscript' ] },
          { tag: 34, name: 'printer-is-accepting-jobs', value: true },
          { tag: 33, name: 'queued-job-count', value: 0 },
          { tag: 68,
            name: 'pdl-override-supported',
            value: 'not-attempted' },
          { tag: 33, name: 'printer-up-time', value: 4 },
          { tag: 49,
            name: 'printer-current-time',
            value: 2018-10-02T20:08:49.797Z },
          { tag: 68,
            name: 'compression-supported',
            value: [ 'deflate', 'gzip' ] } ] } ] } +1ms
  ipp-printer HTTP request: POST / +236ms
  ipp-printer IPP/1.0 operation 2 (request #2) [ { tag: 1,
    attributes:
     [ { tag: 71, name: 'attributes-charset', value: [ 'utf-8' ] },
       { tag: 72,
         name: 'attributes-natural-language',
         value: [ 'en-us' ] },
       { tag: 69,
         name: 'printer-uri',
         value: [ 'http://localhost:3000' ] },
       { tag: 66, name: 'job-name', value: [ 'Test Page' ] },
       { tag: 66,
         name: 'requesting-user-name',
         value: [ 'daniel.breen' ] } ] },
  { tag: 2, attributes: [] } ] +1ms
[job 1] Printing document: Test Page
  ipp-printer responding to request #2 { version: { major: 1, minor: 0 },
  statusCode: 0,
  requestId: 2,
  groups:
   [ { tag: 1,
       attributes:
        [ { tag: 71, name: 'attributes-charset', value: 'utf-8' },
          { tag: 72, name: 'attributes-natural-language', value: 'en-us' },
          { tag: 53,
            name: 'status-message',
            value: { lang: 'en-us', value: 'successful-ok' } } ] },
     { tag: 2,
       attributes:
        [ { tag: 33, name: 'job-id', value: 1 },
          { tag: 69,
            name: 'job-uri',
            value: 'ipp://DESKTOP-RJMKARL:3000/1' },
          { tag: 35, name: 'job-state', value: 5 } ] } ] } +9ms
[job 1] Document saved as job-1.ps

Sending universal subtype

Hi,

I'm trying to send the universal subtype but can't get it working. I'm calling bonjour as follows:

bonjour.publish({ txt: {rp: 'printers/Printer1', usb_MFG: 'Astrium', usb_MDL: 'Astrium Printer 1', product: '(Astrium Printer)', ty: 'Astrium Printer', pdl: 'application/pdf,image/urf', URF: 'W8,DM3,CP255,RS600'}, type: 'ipp', port: printer.port, name: printer.name, subtypes: [ '_universal']})

I've tried removing the underscore as well.

Any suggestions?

Very slow on low cpu computers

Very slow on low cpu computers.
I have a virtual printer written using this module. In all my past test works good (with decent CPU computers), but after usage in real clients, report me very slow application. After some tests, i see that slow is in receive the job.
I tested for example in Atom C2350, with notepad++ write a little test, and press CTRL+P, delays about 10 seconds in shows printer dialog, and later make click in print, delays about 20 seconds in receive file in nodejs code. If I delete the virtual printer, printer dialogs shows in 1 second, and all other printers don't delay more than 2 seconds in receive documents. I really can confirm that delay is only with printers created with this ipp-printer

error

/Users/homes/electron/electron-quick-start/node_modules/bonjour/lib/registry.js:95 Uncaught TypeError: timer.unref is not a function

iOS Client not sending number of copies

Hi Everyone,

Am developing a server app that talks to client and act as a printer. There are few elements i noticed when reading data that are sent from the client to my app. For instance, when i print a document with 1 copies i can see the data coming in as Application/PDF format and i get the number of copies as 1(which is right) and also many other element such as the sides, color etc... BUT when i do the same thing with number of copies greater than 1 the data are converted in image/urf and i don't get the number of copies.
Can someone please help me understand why is iOS client converting the data to image/urf, what is image/urf and why is the client not sending the number of copies when i print multiple copies of a single document.

Does not work with ipp 2.0

williamkapke/ipp reported below error:

{
  "_err": null,
  "_res": {
    "version": "1.1",
    "statusCode": "server-error-version-not-supported",
    "id": 19651158,
    "operation-attributes-tag": {
      "attributes-charset": "utf-8",
      "attributes-natural-language": "en-us",
      "status-message": "en-us\u001eserver-error-version-not-supported"
    }
  }
}

Printer cannot be located on Windows 10

I tried using the module on Windows 10. With the code provided in the README, and as a global module. In both cases, Windows could not see the printer automatically, nor could it detect it when I went through manual steps for a network printer.

I suspect it may have something to do with IPv6 - when I use the global module from the command line, I get ipp-printer listening on: http://[2001:0:9d38:6abd:34f7:1a09:3f57:ff3b]:3000. I tried using that as an IP for Windows to detect - still no printer found.

Am I missing something? How can I use this module in Windows?

Unable to receive printjob from StoreHub POS

I am trying to connect StoreHub POS iOS based application to send thermal printer receipt to print on ipp-printer. I can see the printer on the iOS app but it does not show anything when a test print is sent from iOS to ipp-printer running in raspberry pi.

Can I configure global IP address where printer is installed in windows?

As far as I've found out, to use the printer programatically in a node project, one has to install the printer globally and then do "add printer" in windows using the IP address that ipp-printer is installed in globally. However, the issue is that I have to change my node code every time I run the code on a different machine. Therefore, is it possible to configure ipp-printer's IP address when it is installed globally? or do I have to work with the default random IP it gets installed on? If it is configurable, then I can probably create a batch file to install the printer on a certain IP and not change the node config variable each time it is used on a new system.

SNMP Implementation

I am currently using this as a way of testing some code against this as a virtual printer instead of having to use the real thing.

What would make it perfect is if it could simulate SNMP somehow without me having to run a SNMP simulator individually.

Intermediate configuration window

Hey @watson! First of all, thank you for the great project!

I'd like to build a solution based on yours but it requires some custom logic.

The requirement I have is a configuration window that appears when a print job is sent to the ipp-printer. In that window, I can pick some business-logic related parameters, like who is responsible for the document, etc.

To give you an idea how it could look like, here is an example of some other solution. The window appears on 2m37s.

What I can think of so far, is implementing the configuration window as a separate sub-program and call that program as soon as a new job arrives here. In the sub-program I can do all required configuration and pass the results back to the node.js part of the printer, where the execution continues.

If you have any suggestions I'd much appreciate it! Thanks!

Have to install bonjour on window to be detected as nearby printers.

Hello Mr. Watson

I am running ipp-printer on my mac and i want to add this printer on windows. I needed to install bonjour in order to detect it as nearby printers, the default add print setup does not detect it as a network printer. Is there any change i can do in order to avoid installation on bonjour on windows

iOS Client repeating POST request after server return HTTP 401 Unauthorized error

I'm developing a new Airprint Server App for IOS device/Client. I have Everything working apart from the Authentication. IOS client repeat Post Request after receiving HTTP 401 Unauthorized error from the server. From the server App Console i can see the request being repeated/fired 3 times. My goal is to have the client react to the very first HTTP 401 Unauthorized response and display a UI for Username and password

How can i prevent the POST request from client to be repeated 3 times?
Any suggestion?

Printer Server responds very late (>1 minute) on some Windows 7 machines.

I've found out by installing this on multiple windows 7 systems that in some cases it takes increasingly more time to respond to any request. The first request might take 15 seconds, but the longer the server/printer exists in the system (this doesn't even relate to whether it's the first or the 100th request), the time it takes to even register that request gets longer and longer. After 3 days on installing the printer, it took around 2 minute to just respond to a print request. I haven't been able to hone out on which Windows 7 systems/editions this issue takes place, but it does on the majority of them. Been trying to find a solution since the last 2 months but unable to do so. Any help would be greatly appreciated.

Need someone to continue the project

Hello,
We would like hire someone to continue this awesome project. Is there anyone can continue the project with the following features implemented?

  1. The rest IPP Versions.
  2. Auth feature
  3. AirPrint on iOS Supported (capable to receive image/urf)
  4. Convert to PDF for the job received.
  5. Specify this is printer or proxy and forward to the specified printer

Printer is not visible on windows

This is my code(ipp-printer.js):

var fs = require('fs')
var Printer = require('ipp-printer')

var printer = new Printer({name:"ipp-printer", port:8080})
console.log(printer);
printer.on('job', function (job) {
console.log('[job %d] Printing document: %s', job.id, job.name)

var filename = 'job-' + job.id + '.ps' // .ps = PostScript
var file = fs.createWriteStream(filename)

job.on('end', function () {
console.log('[job %d] Document saved as %s', job.id, filename)
})
job.pipe(file)
})

then i run the code > node ipp-printer.js

But i couldn't find the printer "ipp-printer" anywhere. How can i add/find the printer? Please help me. Any help will be appreciated. I am a beginner in Node. So sorry if i am asking anything wrong.

color setting and copies attribute

Hi
I'm interested in getting job attributes like copies and color setting. I searched a lot but could not find the information I require.
Is there any way to print attributes(ATTR_GROUP_JOB_TMPL) ?

expose the printer?

Hello, thanks for the module!!!
Is there any way i can expose the printer to the local wifi environment without adding the printer manually under system preference in OSX?
Thanks~~

Different Paper Sizes?

Is it possible to additional paper sizes besides the standard 8.5x11? If so how to do it?

Donot show in windows printer

Hi
I use below code in electron js but donot add any printer in windows printers

`var fs = require('fs')
var Printer = require('ipp-printer')

var printer = new Printer('My Printer')

printer.on('job', function (job) {
console.log('[job %d] Printing document: %s', job.id, job.name)

var filename = 'job-' + job.id + '.ps' // .ps = PostScript
var file = fs.createWriteStream(filename)

job.on('end', function () {
console.log('[job %d] Document saved as %s', job.id, filename)
})

job.pipe(file)
})
`

Multiple Printers using the same server

I'm trying to wrap my head around how instantiating multiple printers works. It looks like the functionality is close to existing since you can pass a pre-existing server into the Printer object. The problem is that onrequest is called on the server for every printer which is instantiated

server.on('request', onrequest)
so if I instantiate two printers with a pre-existing server and then send a print job to one of them the onrequest handler gets called twice and then it blows up because it is mutating the req._body field during each call
req._body = ipp.request.decode(req._body)
. Was this not intended to allow multiple printer objects?

Airprint

Can the printer be advertised in a AirPrint compatible way ?

MultiPrinter

First, Great JOB,
Second can I use the virtual printer to send same job to multi printer on same network?
because I have project need to print same job on multi printer.
do you have any advice?
and I tried to use Programmatic code , but it didn't listen , although the cli work fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.