Network printers / PDF / netcat

Jean-Pierre A. Radley appl at jpr.com
Mon May 28 11:53:17 PDT 2012


John Sica propounded (on Mon, May 28, 2012 at 09:01:30AM -0700):
| I know I'm late to the topic, but this works for me (requires gs, but is 
| usually already installed on most systems).  I've been using it for 
| about 5yrs.
| 
| If anyone has an easier way to do this, I'd like to know.
| ==========================================================
| 
| If you type this command from the command line, it will convert a
| pdf document (simple.pdf), and it will create a pcl
| document in the location specified by -sOutputFile=
| 
| gs -sDEVICE=ljet4 -q -dNOPAUSE -dSAFER -sOutputFile=/tmp/simple.pcl
| /simple.pdf -c quit
| 
| You should then be able to print the file to a standard laserjet.
| 
| cat /tmp/simple.pcl | netcat -d -h"printer-ip-address" -p9100

Not only a useless use of 'cat', John, but also a useless use of a
/tmp/file.  Here's the script I use (it feeds the default printer,
no big deal to change it to pick a specific printer).

 gs -q -sDEVICE=djet500 -dNOPAUSE -sOutputFile=- ${@:--} -c quit | lp -og -s

It accepts arguments of files to be printed, or else processes STDIN.

I use djet500 instead of ljet4 so as to get color printing.

-- 
JP


More information about the Filepro-list mailing list