watson / ipp-printer

An IPP printer written in Node.js
MIT License
549 stars 81 forks source link

ipp-server does not respont on a job #28

Open afeldman opened 5 years ago

afeldman commented 5 years ago

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
Dexshin commented 4 years ago

Hi,

I'm facing the same issue here. Did you get any solution or workaround ? Would love to know ! :)

itamardavidyan commented 3 years ago

@afeldman Did you success to convert postscript to pdf?