File.Copy() supports both local ports, like LPT1 and shared printers like FRONTCOUNTER LabelPrinter. However, now I'm trying to get it working with a printer that's directly on the network: 192.168.2.100, and I can't figure out the format to use. To send a PostScript file or a non-PostScript printer file to a network printer, capture the network printer as a port device, and then copy the file to that port as a local printer. In some network configurations, capturing a network printer makes the printer unavailable to other users. File.Copy() supports both local ports, like LPT1 and shared printers like FRONTCOUNTER LabelPrinter. However, now I'm trying to get it working with a printer that's directly on the network: 192.168.2.100, and I can't figure out the format to use. Sep 06, 2012 I am trying to print a file through a batch file to a locally installed printer which was installed using an IP address as the port. I know the print command print /d:LPTx or print /d:COMx or if u have a network user print /d: server printername. Oct 29, 2003 I know that for printing to a printer directly connected to the computer lpt1 port, the command is 'copy filename.prn lpt1/b' but how do I print to a network.
I have currently-working code which sends raw data to a printer by writing a temporary file, then using File.Copy()
to send it to the printer. File.Copy()
supports both local ports, like LPT1
and shared printers like FRONTCOUNTERLabelPrinter
.
However, now I'm trying to get it working with a printer that's directly on the network: 192.168.2.100
, and I can't figure out the format to use.
I know it's possible to 'Add a printer' from each computer, but I'm hoping to avoid that - the second line of code above works from any computer on the network automatically, with no configuration required. I also know it's possible to P/Invoke the windows print spooler, and if that's my only option I may take it, but that's much more code overhead than I'd like to have.
Ideally, someone will have either a way to make File.Copy()
work or a similar C# statement which will accept a network IP.
Copy Printers To New Computer
2 Answers
You can use sockets and send the data straight to that IP address. Should pretty much be the same as File.Copy
. I just tried it out and that worked.
Iseries Copy File To Network Drive
I just sent some text but here is the code that I used
Kirk BackusKirk BackusNot the answer you're looking for? Browse other questions tagged c#printingnetwork-printers or ask your own question.
I have an Epson TM-T88V network printer. I can print to it using the printer driver. But I need to copy a 'print file' to the printer using the command line, and this causes problems.
I cannot use
Because this will simply copy the file to a new file with the name of the ip address.
I have seen various suggestions... that do not seem to work:
The specified path is invalid
This one too failed me:
System error 66 has occurred.
The network resource type is not correct.
Trying to ftp the file over failed, too. (Could not open a connection.)
Any ideas how to go about this?
Ola EldøyOla Eldøy5 Answers
Use Microsoft's lpr
client
This works with JetDirect and similar boxes/adapters as well as Unix/Linux and Windows servers that have the LPD service enabled.
GaffFrom the command prompt:
If there is a space with the print share name be sure to enclose in quotes. For example:
Karanlpr works great on Win 7 and up. You do not need to copy it. In Control Panel, go to 'turn windows features on or off' and make sure 'print and document services' are installed.
To use lpr to send a file to printer that uses the RAW protocol, the syntax is:
Sam JonesSam JonesTry sharing the local printer connection and then connect it to LPT1
Just share the folder c:windowssystem32spoolprinters in which the shared printer is connected for everyone with full control both in share and security menu. That will work fine.