|
Contributed by: Michael Lossin
Version: 7.2.x and later
Level: intermediate - expert
Another contribution from M. Lossin for configuring apsfilter to use
personal apsfilter configs for printing from misc applications.
As we all know from reading the handbook, aps2file gives
us the great opportunity to use "user managed" apsfilterrc
configuration files without the usual security risks involved.
This is because in this case apsfilter is executed by a
user program (AbiWord or Mozilla, etc) with the corresponding
user permissions - and not root or daemon permissions.
E.G., in a file like $HOME/.apsfilter/apsfilterrc.lp you
can make permanent settings for the printer queue named
"lp" that changes apsfilter's default behaviour (like
resolution / colour, etc) for a given user. The good thing
is, there is no need to resort to the sysadmin for help in
making these changes to the actual printer's default settings.
However, the bad thing is you have to remember the long
command:
"aps2file -Z aps:filter:options file | lpr -Pqueue -C raw"
The following piece by M. Lossin seeks to automate what we
have explained here in a way that allows you to substitute
the lp/lpr command, by parsing the printer queue name and
print options to the aps2filter command.
If you want apsfilter to use your personal configuration, as per
(~/.apsfilter/apsfilterrc.QUEUE) at all times, you can substitute
the "lpr" command with something like: $HOME/bin/my_lpr.
Create a script "$HOME/bin/my_lpr":
"#!/bin/sh" - DON'T INCLUDE THE QUOTES ON THIS LINE, PLEASE
args="$@"
unset my_queue
while [ "$1" ]; do
case "$1" in
-P) shift; my_queue="$1" ;;
-P*) my_queue="${1#-P}" ;;
esac
shift
done
aps2file $args | lpr ${my_queue:+-P$my_queue} -Craw
Make the script executable:
chmod 755 $HOME/bin/my_lpr
And this should work (TM). NOTE: if your spooler uses "lp" and not
"lpr", replace each occurance of "-P" with "-d" and "lpr" with "lp"
Usage: my_lpr [-Pqueue] [-Z apsfilter:options] file
|