* Re: filtering jobs sent to a remote machine
1998-04-06 4:00 filtering jobs sent to a remote machine bob.findlay
@ 1998-04-06 4:00 ` James Hebert
1998-04-07 4:00 ` Jacob Langford
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: James Hebert @ 1998-04-06 4:00 UTC (permalink / raw)
bob.findlay@bbsrc.ac.uk writes:
> Hello,
> I want to be able to filter a printer's jobs. The problem is, that I
> want to filter on machine A (OSF), but the queue is actually on machine
> B (NT). Does anyone know how I can fool printcap into filtering the job
> and then passing it on to the NT machine? I'm using lpr
LprNG, IIRC, has a very easy solution to this, called a bounce queue
or something like that.
My RedHat box at home, come to think of it, somehow accomplishes this
without that. Without looking, I'll bet it sets up a null printer
(device is /dev/null, say) and writes an "accounting filter" which
really printfilter's the job and then sends it on to NT. But that's
just a WAG.
HTH
jim
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: filtering jobs sent to a remote machine
1998-04-06 4:00 filtering jobs sent to a remote machine bob.findlay
1998-04-06 4:00 ` James Hebert
@ 1998-04-07 4:00 ` Jacob Langford
1998-04-08 4:00 ` Emmanuel Choquet
1998-04-09 4:00 ` Ernest LaBonte
3 siblings, 0 replies; 5+ messages in thread
From: Jacob Langford @ 1998-04-07 4:00 UTC (permalink / raw)
bob.findlay@bbsrc.ac.uk wrote:
> Hello,
> I want to be able to filter a printer's jobs. The problem is, that I
> want to filter on machine A (OSF), but the queue is actually on machine
> B (NT). Does anyone know how I can fool printcap into filtering the job
> and then passing it on to the NT machine? I'm using lpr
>
> thanks (in hope)
> Bob Findlay
Why not just add something like
:if=/full/path/to/filter:
to machine A's printcap file?
Jacob (langford@uiuc.edu)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: filtering jobs sent to a remote machine
1998-04-06 4:00 filtering jobs sent to a remote machine bob.findlay
1998-04-06 4:00 ` James Hebert
1998-04-07 4:00 ` Jacob Langford
@ 1998-04-08 4:00 ` Emmanuel Choquet
1998-04-09 4:00 ` Ernest LaBonte
3 siblings, 0 replies; 5+ messages in thread
From: Emmanuel Choquet @ 1998-04-08 4:00 UTC (permalink / raw)
To: bob.findlay
bob.findlay@bbsrc.ac.uk wrote:
> Hello,
> I want to be able to filter a printer's jobs. The problem is, that I
> want to filter on machine A (OSF), but the queue is actually on machine
> B (NT). Does anyone know how I can fool printcap into filtering the job
> and then passing it on to the NT machine? I'm using lpr
>
> thanks (in hope)
> Bob Findlay
Not from me ,but got it some time ago in this news group, works well, I did
it several times. :
From: schroedj@ub.uni-marburg.de (Juergen Schroeder)
The lack of filtering by printing remote is usual in most unix (lpd) types.
This can't be elegant overided by a old but not well known trick:
make a printqueue which print raw to the remote printer
make multiple printqueues for the features you want have
eg one called landscape
this should have this entries in the printcap:
:if=/usr/local/daemon/filter/input_filter_landscape:\
:lp=/dev/null:\
make the filter input_filter_landscape
(echo "here the esc-sequences for initialising the printer & landscape mode"
cat - ) | lpr -Praw
thats all
you can make this queues if you want on only one machine and print remote
to this machine.
No fiddeling with lpd source code.
--
Emmanuel Choquet
Informatique Client/Serveur
& Communication
_/
_/
_/ _/_/_/ _/ _/_/_/
_/ _/ _/ _/
_/ _/ _/ _/_/_/
_/ _/ _/ _/
_/ _/_/_/ _/ _/_/_/
ics@cica.fr
c/o Cica Tel: (33) 4 92.94.23.50
2229, route des cretes fax: (33) 4 92.94.23.54
06560 Sophia-Antipolis
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: filtering jobs sent to a remote machine
1998-04-06 4:00 filtering jobs sent to a remote machine bob.findlay
` (2 preceding siblings ...)
1998-04-08 4:00 ` Emmanuel Choquet
@ 1998-04-09 4:00 ` Ernest LaBonte
3 siblings, 0 replies; 5+ messages in thread
From: Ernest LaBonte @ 1998-04-09 4:00 UTC (permalink / raw)
To: bob.findlay
[-- Attachment #1: Type: text/plain, Size: 359 bytes --]
bob.findlay@bbsrc.ac.uk wrote:
>
> Hello,
> I want to be able to filter a printer's jobs. The problem is, that I
> want to filter on machine A (OSF), but the queue is actually on machine
> B (NT). Does anyone know how I can fool printcap into filtering the job
> and then passing it on to the NT machine? I'm using lpr
>
> thanks (in hope)
> Bob Findlay
[-- Attachment #2: t.txt --]
[-- Type: text/plain, Size: 4099 bytes --]
Bob,
You stated the printer is on an NT machine but I will mention this anyway.
If the printer has a network card and you are running V4.0a or later
I suggest using tcp/ip printing and print to the printer directly. That
way you get to use print filters with no special modifications.
Ok, now for remote printing filtering.
There are a few ways to do this but non straight forward. The easiest way
is to preprocess the file before submitting it to the queue. For example,
people who want to convert text to postscript would enter:
cat file.txt | /usr/lbin/ln03rof | lpr -Premotequeue
or to get postscript landscape (2 examples depending on the version)
cat file.txt | /usr/lbin/ln03rof -Ow132 | lpr -Premotequeue
cat file.txt | /usr/lbin/ln03rof -Olandscape | lpr -Premotequeue
This method doesn't work well for multiple files. The script below will
help in this area. The script defaults to /usr/lbin/ln03rof. You can
specify an alternate filter at the command line, or edit the script to
default to another filter.
Hope this helps,
Ernest
---------------
#!/bin/ksh
# lprcat 19-May-1996
#
# General purpose script to preprocess a file prior to printing. Useful when
# printing to a remote queue or to a network printer using lpd remote
# communication.
#
# The default is to convert text to postscript using the /usr/lbin/ln03rof
# filter but any filter can be specified/utilized.
#
# Usage: script [-ffilter] [options] file file ...
#
# [filter] - use an alternate filter located in /usr/lbin.
# [options] - options that would be specified in a lpr command line.
# file - the file or files to print
#
# eg: script -Pxxx -w50 -Olandscape file file
# script -flpf -Pxxx -x -h file file
#
# Function: fcat
#
# Description: Cat one or more files through a print filter
#
# Arguments: $1 - filter to use
# $2 - optional filter arguments
# $3-$* - additional filenames
#
function fcat {
filter=$1 # Save the filter name
shift
cmd=$1 # Optional filter arguments
shift
while [[ -n $1 ]] # Cat each filename provided through the filter
do
eval /bin/cat $1 | $filter $cmd
shift
done
}
# Function: fverify
#
# Description: Verify all the files exist.
#
# Arguments: $* - List of filenames to list
#
function fverify {
while [[ -n $1 ]]
do
if [[ ! -f $1 ]]
then
print "ERROR: Unable to print file $1."
exit 1
fi
shift
done
}
# Initialize variables
filter="/usr/lbin/ln03rof"
cmd=""
queue=""
xf=""
sh=""
#
# Code starts here
#
# Parse out filter options and lpr options
# Of course it's up to the filter to decide if the option will be used.
while getopts :f:P:z:w:i:O:K:I:o:l:xhs opt
do
case $opt in
P) queue="-P$OPTARG " # Queue name
;;
h) sh="-h " # Suppress banner page
;;
x) xf="-x " # Use xf filter
;;
f) filter="/usr/lbin/$OPTARG" # Specify alternate filter
;;
i) cmd="$cmd -i$OPTARG" # Indent
;;
l) cmd="$cmd -l$OPTARG" # Page length. Filter option.
;;
o) cmd="$cmd -o$OPTARG" # Output tray
;;
s) print "ERROR: Symbolic link option -s not allowed!"
exit 1
;;
w) cmd="$cmd -w$OPTARG" # Page width
;;
z) cmd="$cmd -l$OPTARG" # Page length if lpr did support it.
;;
I) cmd="$cmd -I$OPTARG" # Input tray
;;
O) cmd="$cmd -O$OPTARG" # Orientation
;;
\?) print "ERROR: Unknown option $OPTARG."
exit 1
;;
:) print "ERROR: Option $OPTARG requires a parameter."
exit 1
esac
done
# Now remove all the options and (hopefully) leave only file names
shift $OPTIND-1
# Check to see if the print filter exists
[[ ! -a $filter ]] && print "ERROR: Print filter $filter not found!" && exit 1
# If no filenames print a message and get out
[[ -z $* ]] && print "ERROR: Missing filename argument!" && exit 1
# Check to see if all the files specified exist
fverify $*
# The way the command option string is created the first two characters are
# <space>- so if a command string exists remove the leading space
[[ -n $cmd ]] && cmd=$(print "$cmd" | /bin/cut -c2- )
# Now run each file through the filter and pipe the results to lpr
fcat "$filter" "$cmd" $* | /bin/lpr $queue$sh$x
^ permalink raw reply [flat|nested] 5+ messages in thread