[rhn-users] Using filters to format print files

Stephen Gilbert linuxelf at gmail.com
Tue Jul 18 11:50:18 UTC 2006


You can easily create a filter using cups.  Create a new backend in
/usr/lib/cups/backend.  This can be any executable, including scripts.  What
cups will do is pass to this executable everything you need to know about
how to get the printed file to parse it.  Your new backend will then show up
in your cups configuration as a new printer type.  The following is a little
perl script we use to implement a printing dropfolder.

 #!/usr/bin/perl
$argument_count = @ARGV;
if ($argument_count == 0){
open OUTFILE,(">/tmp/cups.error");
print "direct drop \"Unknown\" \"Drop Folder\"\n"
exit(0);
}

if (($argument_count < 5) || ($argument_count > 6)){
open OUTFILE,(">/tmp/cups.error");
print OUTFILE "Usage: drop job-id user title copies options [file]";
print "Usage: drop job-id user title copies options [file]";
exit(1);
}

$dropdir=$ENV{'DEVICE_URI'};
$dropdir =~ s/drop://;
unless (-w $dropdir){
open OUTFILE,(">/tmp/cups.error");
print "ERROR: directory $dropdir not writable\n";
print OUTFILE "ERROR: directory $dropdir not writable\n";
exit(1);
}

$cupsfile = $ARGV[5];
`cp \"$cupsfile\" \"$dropdir\"`;


On 7/18/06, d.qureshi at mdx.ac.uk <d.qureshi at mdx.ac.uk> wrote:
>
> Does anyone know how to use a filter to format print files to a printer?
> I used printtool on RedHat AS 4 to create a print queue.  I am aware the
> printcap file
> cannot be editted to put a input filter.
> Any help would be appreciated.
> Thankyou.
>
> _______________________________________________
> rhn-users mailing list
> rhn-users at redhat.com
> https://www.redhat.com/mailman/listinfo/rhn-users
>



-- 
Stephen Gilbert
RHCE - 804006953620491
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/rhn-users/attachments/20060718/0a4e7045/attachment.htm>


More information about the rhn-users mailing list