[cups.general] Better way to add a filter to a printer ?

Helge Blischke H.Blischke at srz-berlin.de
Fri Nov 5 06:58:56 PST 2004


What damn printer is that which does not know how to change the 
input trays?

Helge

Tom Schutzer-Weissmann wrote:
> 
> I'm trying to add a filter to a printer so that it becomes a
> pseudo-printer visible to Windows clients, but I'm not sure my approach
> is a very good one - can anyone comment or suggest a better way?
> 
> All it needs to do is pipe the first page to one printer, and the rest
> to a different printer.
> 
> I replaced foomatic-rip in the PPD file with foo-foomatic-rip:
> *cupsFilter:    "application/vnd.cups-postscript 0 foo-foomatic-rip"
> 
> and created a perl script called foo-foomatic-rip:
> 
>         #!/usr/bin/perl
> 
>         # pipe input to a temporary file
>         my $tmpfile = $ENV{'TMPDIR'} . '/' . time ;
> 
>         open( TMP , ">$tmpfile") || die "$!" ;
>         print TMP <STDIN> ;
>         close TMP ;
> 
>         print STDERR "$tmpfile" ;
>         $firstpage = $tmpfile . 'f' ;
>         $rest = $tmpfile . 'r' ;
> 
>         `psselect -p1 $tmpfile $firstpage && cupsdoprint -P Headed
>         $firstpage` ;
>         `psselect -p2- $tmpfile $rest && cupsdoprint -P Unheaded $rest`
>         ;
> 
>         unlink $tmpfile ;
>         unlink $firstpage ;
>         unlink $rest ;
> 
> Of course, if the damn printer honoured commands to change input tray,
> none of this would be necessary :)
> 
> Thanks for your help,
> Tom SW
> 

-- 
Helge Blischke
Softwareentwicklung
SRZ Berlin | Firmengruppe besscom
http://www.srz.de
tel: +49 30 75301-360





More information about the cups mailing list