I have a Windows Server-based machine which acts as a print server.
I've installed a network printer using TCP/IP port and shared it.
Its IP is 192.168.4.101
(queue name MyPrinter
), my server is 192.168.4.1
(hostname WIN-SERVER
)
I'm trying to print a document on the server using LPR:
lpr -S "192.168.4.1" -P "MyPrinter" "C:\document.pdf"
LPR fails with Error: print server unreachable or specified printer does not exist.
.
If I use printer IP address directly, all works fine, but I don't see the print job in the queue on the server:
lpr -S "192.168.4.101" -P "MyPrinter" "C:\document.pdf"
It seems that there is something specific with printing from the localhost itself.
Could you please advise how I can make it work?
The printserver must have the LPD service enabled:
In case of Windows
To print to print-queue on a printserver:
LPR -S servername -P printename -o l C:\file.pdf
or
LPR -S servername -P printename C:\file.txt
To print directly to printer (This doesn't seem to be documented, but it works)
LPR -S printername -P raw C:\label.pdf
As as alternative, whish doesn't require LPD, is to simply use the copy
command:
copy "c:\label.pdf" \\localhost\pr01
Neither LPR nor COPY will provide you much error control. It will only fail if the printer, print-server or print-queue doesn't exist. It will not give any errors if the printer is not able to print the file e.g. if the printer doesn't support Direct PDF Print or the file is corrupt or in some other ways isn't supported by the printer.