[cups.general] Re: modify print job name

Johannes Meixner jsmeix at suse.de
Fri Jul 14 02:29:17 PDT 2006


Hello,

On Jul 14 04:42 Antonis Tsolomitis wrote (shortened):
> I can find pipe only for Suse, in their cups-backends rpm.

It is a plain perl script - i.e. it schould run everywhere:
-------------------------------------------------------------------
#!/usr/bin/perl -w

# CUPS backend for printing to any program via pipe
# Copyright (c) 2003 SuSE Linux AG, Nuernberg, Germany.
# Author: Jiri Srain <jsrain at suse.cz>, 2003

$scheme = "pipe";

if (@ARGV == 0)
{
   print "file $scheme \"Unknown\" \"Printing to any command via pipe\"\n";
   exit 0;
}

   
# in case of wrong number of arguments: print usage hint
if (@ARGV != 5 && @ARGV != 6)
{
   print STDERR "
Usage: pipe job-id user title copies options [file]
       example for device-URI: 'pipe:/path/to/targetcommand'

Install a printqueue with 'lpadmin -p <pipe-printer-name>
-v pipe:/</path/to/targetcommand> -E

";
   exit 1;
}

if (defined ($ARGV[5]))
{
    $file = $ARGV[5];
}
else
{
    $file = "-";
}

# get file to which the job is "printed" from device URI, so
# so that you can use this backend multiple times, for various
# "pipe" printers...

$uri = $ENV{"DEVICE_URI"};

$arg = $uri;
$arg =~ s/$scheme:(.*)/$1/;

$cmdln = "/bin/cat $file | $arg";

if ($> == 0)
{
    $cmdln = "su -c \"$cmdln \" lp";
}

my $exit = system ($cmdln);
if ($exit != 0)
{
    print STDERR "ERROR: Error occurred while executing $cmdln";
}
exit $exit >> 8;
-------------------------------------------------------------------

See "man backend" regarding how to write your own backend.
Save it as /usr/lib/cups/backend/pipe
Set read and execute permissions accordingly.
Restart the cupsd.
Verify that the new backend is shown in "lpinfo -v".


Kind Regards
Johannes Meixner
-- 
SUSE LINUX Products GmbH, Maxfeldstrasse 5      Mail: jsmeix at suse.de
90409 Nuernberg, Germany                    WWW: http://www.suse.de/





More information about the cups mailing list