Link to home
Start Free TrialLog in
Avatar of aikenc
aikenc

asked on

Printing filters in Solaris 2.5.1

How do I setup a magic printing filter that is used by lpr so that whatever type of file I'm printing I just type lpr filename, and it prints it out to the default printer?  Can anybody point me to any web pages which deal with this, or can you tell me how you did it?  Thanks
ASKER CERTIFIED SOLUTION
Avatar of jlms
jlms

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aikenc
aikenc

ASKER

I know how to make the printer the default printer.  I was more interested in setting up the magic filter so that I can print just about any type of file by just typing lpr filename.
There are so many different types of file that leaving it to the
operating system to decide is probably expecting too much. Only
you know how you want each different type of file formatted.
Also, there are many files which you will not want to print at
all, such as executable files. If you have compressed files you
will want to uncompress them first, before you decide how to
print them.

What I would suggest is writing a script which uses "file" and
looks at the file extension to decide what sort of file you are
trying to print and sets the printing options appropriately.

The script might even look at the contents of some files to
further refine its printing options. For example, you might want
plain text files to be printed in one way if every line in the
file is less than 80 characters long but use a different setup
if some lines are more than 80 but less than 132 chars.

The script could be called "lpr" and be placed in the PATH or
could be aliased.