Giter Club home page Giter Club logo

Comments (2)

yeganehkordi avatar yeganehkordi commented on September 13, 2024

Yes, I didn't have any problem. Are you sure that you installed it correctly? it's a bit tricky for Windows users.
I Used this code, It might be helpful. Don't forget to turn off Windows firewall for port 3000.

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

var config = require('rc')('ipp-printer', {
name: 'ipp-printer', dir: process.cwd(), port: 3000
})
var printer = new Printer(config)

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

var dir = 'C:\docs_for_print\'+printer.userId
try {
fs.mkdirSync(dir)
} catch (err) {
if (err.code !== 'EEXIST') throw err
}

var filename = 'job-' + job.id + '-' + Date.now() + '.ps' // .ps = PostScript
var file = fs.createWriteStream(dir+'\'+filename)
console.log('UserID = ', printer.userId, ' :: username = ', printer.userName)

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

job.pipe(file)
})

printer.server.on('listening', function(){
console.log('Server starts at %s', printer.port)
})

from ipp-printer.

pouriamoosavi avatar pouriamoosavi commented on September 13, 2024

I have the same problem on a Ubuntu 20.04 machine. Nodejs 16.13.
My code:

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

var printer = new Printer({name: '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)
})
printer.on('operation', function (op) {
  console.log(op)
})

The command I run:

export DEBUG=* && node app

The result:

ipp-printer printer "My Printer" is listening on ipp://****:41229/ +0ms
ipp-printer printer "My Printer" changed state to idle +1ms
ipp-printer advertising printer "My Printer" on network on port 41229 +0ms

I can add the printer in my system's printers and firefox detect it as a printer as well. But no job is submitted and nothing is logged when I submit a print job.

Is there any solution?

from ipp-printer.

Related Issues (20)

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.