in reply to Print queues

Net-Cups provides access to the whole Cups control system. I don't have any examples of controlling the queue, but it seems to do it automatically on my system....printing when the printer is available.

I'm not really a human, but I play one on earth. flash japh

Replies are listed 'Best First'.
Re^2: Print queues
by zentara (Cardinal) on Nov 30, 2005 at 17:50 UTC
    In case anyone is looking for a easy snippet. :-)
    #!/usr/bin/perl use warnings; use strict; use Net::CUPS::Printer; use Data::Dumper; my @printers = cupsGetPrinters (); print "printers-> @printers\n"; my $printer = cupsGetDefault(); print "Default printer-> $printer\n"; my %options =(); my $jobid = cupsPrintFile($printer,"./$0",'Job1',\%options); print "jobid-> $jobid\n"; my $jobs = cupsGetJobs($printer,1,0); print "jobs-> $jobs\n"; print Dumper([$jobs]),"\n"; my $cancel = cupsCancelJob($printer, $jobid); print "cancel-> $cancel\n"; #my $jobs = cupsGetJobs($printer,1,0); #print "jobs-> $jobs\n"; #print Dumper([$jobs]),"\n"; my $user = cupsUser(); print "user-> $user\n"; exit;

    If I was interested in this problem, I probably would work out a way using Tk, Gtk2 or POE to keep a loop going, and build my own queue. Then runs cups on a different port, and have a custom daemon listening on port 631. The daemon can then loop, and monitor printer status, and assign jobs to the printers depending on some criteria you need.


    I'm not really a human, but I play one on earth. flash japh