如何使用Node.js创建虚拟打印机

时间:2019-07-02 10:14:51

标签: node.js printers ipp-protocol

我尝试这样创建虚拟打印机 enter image description here

我尝试使用ipp-printer模块创建虚拟打印机,但无法添加打印机

var fs = require('fs') 

var Printer = require('ipp-printer')

var printer = new Printer({name:"my-printer", port:8081})
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)
})

在添加打印机屏幕上看不到我的打印机名称

enter image description here

0 个答案:

没有答案