tags:

views:

116

answers:

2
+1  Q: 

HP PCL via TCP/IP

Where can I find an example program in C to print to a network attached HP printer.

+1  A: 

Printing requires a printer driver which handles all the task of communication with the printer.

all you have to worry about is how to print, the fact that the printer is networked or usb or parallel doesn't matter

If you're hardcore and want to use the windows API (assuming you're on windows)

otherwise you could simply redirect output from STDIO like this article suggests

Eric
I don't believe the standard i/o will print to a network attached printer. I would like to use gcc from linux to print raw data to the printer. Looking for code examples.
Tony
Tony, why not pipitas examples? You can either write your own LPD or even FTP the thing to most HP network attached printers.
Xepoch
A: 

It depends how you want to talk to the printer. Nowadays a lot of printers can support many different network protocols to receive jobs. So which is it:

  • IPP (Port 631)?
  • LPR/LPD (Port 515)?
  • AppSocket (Port 9100 and others) ?
  • FTP? RCP? SCP?

Anyway, for most of these cases you can find example code here: http://svn.easysw.com/public/cups/trunk/backend/ -- Further help here: http://www.cups.org/documentation.php/api-filter.html

(However, I wonder why you want to implement such a thing yourself on Linux...)

pipitas