How to send printer output to a file instead of a printer

From: Carl Carraway <carrawayc_at_midlandstech.com>
Date: Fri, 29 Jun 2001 13:54:13 -0400

I need to route output from a printer queue to file instead of to a printer.
 
This needs to function like a "dummy" print queue where the user can
use the lpr command as if they were actually going to print the file, but
the file needs to land in a hold directory where another application
will grab the file and perform special processing that lpd/printcap cannot
perform to produce the output and ultimately send it to a network printer.
 
In /etc/printcap I have defined the following queue, called "testq".
 
testq:\

  :lp=/dev/null:\

  :of=/usr/lbin/testq.of:\

  :sd=/usr/users/spool/testq
  :lf=/usr/adm/testqerr:
 
The output filter (/usr/lbin/testq.of) contains:
 
#! /bin/csh -f

#

# Output filter for testq
#
# Test first to see if the print job can be copied to test.fil
#
/bin/cat > /usr/users/hold/testq/test.fil
 
 
When I enter "lpr -P testq filename" the system queues the job into
the testq queue, where it just sits. The control and data files sit in
the spool directory /usr/users/spool/testq and no file appears in the
desired final hold directory of /usr/users/hold/testq. The lf file is
also blank after executing the lpr command.
 
Also, in my output filter I attempted to copy the file to a file called
/usr/users/hold/testq/test.fil. Is there a way the filename used in the
lpr command can be passed and used to keep the file the same name
when it is routed to the hold directory? If not I could use a timestamp
in the output filter to assign a unique file name.
 
Thanks in advance!

Carl Carraway carrawayc_at_midlandstech.com
Computer Systems Manager 803-738-7624
Midlands Technical College
Columbia, SC
Received on Fri Jun 29 2001 - 18:01:50 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:42 NZDT