Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printer is not visible on windows #21

Open
jaidirectdsn opened this issue Mar 13, 2018 · 10 comments
Open

Printer is not visible on windows #21

jaidirectdsn opened this issue Mar 13, 2018 · 10 comments

Comments

@jaidirectdsn
Copy link

jaidirectdsn commented Mar 13, 2018

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.

@itamardavidyan
Copy link

itamardavidyan commented Sep 29, 2020

@jaidirectdsn You solved this?

@kartikbathla
Copy link

How did you guys actually solve this?

@itamardavidyan
Copy link

I created virtual printer:

this.printer = new Printer({ name: 'PrinterName', port: 3007 })

And then I used powershell script to install the printer:

# Step 1 - Enable InternetPrinting feature
$Feature = Get-WindowsOptionalFeature -Online -FeatureName "Printing-Foundation-InternetPrinting-Client"
if ($Feature.State -ne "Enabled") {
        Enable-WindowsOptionalFeature -Online -FeatureName "Printing-Foundation-Features" -NoRestart
        Enable-WindowsOptionalFeature -Online -FeatureName "Printing-Foundation-InternetPrinting-Client" -NoRestart
}

# Step 2 - Install printer
$Result = Test-NetConnection 127.0.0.1 -Port 2404
If ($Result.TcpTestSucceeded) {
     Add-Printer -Name "PixLetter" -DriverName $PrinterDriverName -PortName "http://$($env:COMPUTERNAME):2404"
} Else {
      throw "Printer port doesn't exposed"
}

@samantrader
Copy link

I created virtual printer:

this.printer = new Printer({ name: 'PrinterName', port: 3007 })

And then I used powershell script to install the printer:

# Step 1 - Enable InternetPrinting feature
$Feature = Get-WindowsOptionalFeature -Online -FeatureName "Printing-Foundation-InternetPrinting-Client"
if ($Feature.State -ne "Enabled") {
        Enable-WindowsOptionalFeature -Online -FeatureName "Printing-Foundation-Features" -NoRestart
        Enable-WindowsOptionalFeature -Online -FeatureName "Printing-Foundation-InternetPrinting-Client" -NoRestart
}

# Step 2 - Install printer
$Result = Test-NetConnection 127.0.0.1 -Port 2404
If ($Result.TcpTestSucceeded) {
     Add-Printer -Name "PixLetter" -DriverName $PrinterDriverName -PortName "http://$($env:COMPUTERNAME):2404"
} Else {
      throw "Printer port doesn't exposed"
}

Hi @itamardavidyan can you explain what is relation of powershell script with use of ipp-printer
and send a full instruction for create a virtual printer with ipp-printer

@itamardavidyan
Copy link

@samantrader

The Powershell script seperated for 2 steps:

  1. Enable InternetPrinting feature - I don't remember why I should enable those windows features but without enable them I can't send files to the virtual printer.
  2. Install printer - The next command:
    Add-Printer -Name "PixLetter" -DriverName $PrinterDriverName -PortName "http://$($env:COMPUTERNAME):2404"
    Is a command line for adding the printer automatically to the printers list of the windows user - it's useful if you don't want that the user will add it manually

About creating virtual printer using ipp-printer you can use the code from the README.md file

@samantrader
Copy link

Hi
If this powershell configuration is necessary for use ipp-printer ?

@itamardavidyan
Copy link

It's not necessary because you can do each of the steps manually

@samantrader
Copy link

I used exactly this code but printer donot show in list of windows printer why ?

`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)
})`

@samantrader
Copy link

samantrader commented Dec 28, 2022

Hi
When I run this command
$Result = Test-NetConnection 127.0.0.1 -Port 2404
powershell return error : WARNING: TCP connect to 127.0.0.1:2404 failed

how can I fix this error ?

@itamardavidyan
Copy link

This command: var printer = new Printer('My Printer') deson't define the port of the virtual printer
Try to debug and see which port number the constructor define to the virtual printer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants