getting number of copies

trushkin vjacheslav trushkin.slava at
Fri Jun 22 01:09:36 PDT 2007

hi, all.
i just started to write a backend. here is source:

use strict;

my $logfile = "/tmp/ptrcnt_log";
my $uri = $ENV{DEVICE_URI};

open (LOG, ">>".$logfile);

print LOG ".\n";
print LOG "DEVICE_URI: ".$uri."\n";

#my $selfname =

if (!@ARGV)
  print LOG "without params\n";
  print "network ptrcnt \"Unknown\" \"Printing accounts\"\n";
  exit 0;

my ($jobid, $username, $title, $copies, $options, $file) = @ARGV;
my $tmpfile;

if (!$file)
  $tmpfile = "/tmp/$jobid-$username-cups$$";
  open (OUT, ">".$tmpfile);

  while (<STDIN>)
    print OUT $_;
  close OUT;
  $file = $tmpfile;

print LOG ">> id = $jobid\n username = $username\n title = $title\n copies = $copies\n opt = $options\n fromfile? = $file\n\n";

$ENV{DEVICE_URI} = "lpd://";
$uri = $ENV{DEVICE_URI};

my $result = system {"/usr/lib/cups/backend/lpd"} ($uri, $jobid, $username, $title, $copies, $options, $file);

exit $result;

i send 2 (or more) copies to this printer, anyway $copies contains "1". I don't know what can it be. Our sysadmin wrote script in VBS for Windows Print Server, and he also can't get number of copies. We have Kyocera FS-3900DN. So, can number of copies be send in options? May be driver makes options where specificates number of copies?

More information about the cups mailing list