Apsfilter Tips & Tricks

This rubric shows some apsfilter tips and tricks. We use the same categories here like the FreeBSD ports collection.

If you have some interesting ideas, feel free to write them to Stacey Roberts who is maintining this page. -Andreas

Thanks for all your kind contributions !!! -Stacey

The Gimphttp://www.gimp.org

Contributed by: Michael Lossin
Version: 1.2.3 and possibly others
Level: easy

If you are using the Postscript output driver from Print Plugin and you don't have a "real" postscript printer, ensure that you DON'T include the "-o raw" option (which is the default).

Using the default ("-o raw") causes apsfilter to pass the input data unmodified, resulting in actual postscript code to be printed. Again, this does NOT apply if you indeed have a postscript printer.


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":

	unset my_queue
	while [ "$1" ]; do
		case "$1" in
			-P)	shift; my_queue="$1" ;;
			-P*)	my_queue="${1#-P}" ;;
	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


Contributed by: Andreas Klemm
Version: all flavours of Unix
Level: easy

Goal: you want to make another system printer to your default printer, so that you don't have to use lpr's -P options again and again.

Simply define the PRINTER variable in your shell environment.

If you don't know which flavour of shell you have, simply type in
echo $SHELL

Type of shell Shell Config File Set this
Bourne Shell and compatible sh, bash $HOME/.profile PRINTER=name; export PRINTER
C-Shell and compatible csh, tcsh $HOME/.cshrc setenv PRINTER

[FreeBSD] Apsfilter Copyright © 1994-2017 Andreas Klemm
Written in WML, page design with permission from Tom Gilbert