Open jaidirectdsn opened 6 years ago
@jaidirectdsn You solved this?
How did you guys actually solve this?
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"
}
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
@samantrader
The Powershell script seperated for 2 steps:
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 manuallyAbout creating virtual printer using ipp-printer you can use the code from the README.md
file
Hi If this powershell configuration is necessary for use ipp-printer ?
It's not necessary because you can do each of the steps manually
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) })`
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 ?
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
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.