[K12OSN] About printing

Brent Norris brent at biglinux.tccw.wku.edu
Tue Apr 27 22:56:56 UTC 2004


On Fri, 2004-04-23 at 09:46, Les Mikesell wrote:
> On Fri, 2004-04-23 at 09:37, Julius Szelagiewicz wrote:
> 
> > 	this is not a requirement you want to fulfill. Since just about
> > everything is printed in postscript, you are out of luck, as postscript is
> > a horrible language to go into and look for stuff (come to think about it,
> > it just horrible). The only sane way to do it, it to look at the documents
> > *before* they are being sent to print. julius
> 
> Errr....
> 
> apt-get install gv
> gv postscript_file ...

Since at least the lp print system runs print jobs through filters
before printing them I would think this would be possible.  I mean I
once used that setup to play Mp3s.  lp -d MyMP3.mp3 with the filter for
the default print queue just being a shell script that called mpg123
with a bit of logic in it and the printer being /dev/null.

I would think you could code some similar stuff into a shell script.
Something like maybe this really rough mock up in psuedo.

#!/bin/bash

gv $i
if xdialog -question "You you want to print this file? -yesno ; then
lp -q real_printer $i
fi
exit

Then set the default print queue to your fake queue with the shell
script as the filter and make another one with a real printer.  If the
lap manager hits yes it sends the job to the real queue and exits if
they hit no it just exits.  Either way the job heads to /dev/null
afterwards so if it isn't approved then it doesn't get printed.  There
are a couple things I don't know here.  The options to xdialog are 100%
not right and you might have some trouble getting gv and xdialog to
output to the correct screen, but this is just something I came up with
in my head.  Feel free to take it and modify it if you think it is
worthwhile.

-- 
Brent Norris <brent at biglinux.tccw.wku.edu>





More information about the K12OSN mailing list