Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My organization has a leased color printer. We pay a per-page cost to the lessor, and the color page cost is far greater than the black-and-white page cost. Our users are pretty good about selecting the correct mode. But the problem comes when they want to print a big job that has only a few color pages. They don't want to manually search through the job to find the color pages and separate them out, and management would like them to not print hundreds of B&W pages at color costs.

For example, imagine a printer where B&W pages cost 1¢ and color pages cost 8¢. A user wants to print a 200 page document. Most of the pages are just black text, but there are ten pages of color diagrams. The user wants to get the diagrams printed in color, but the only way for him to do that is to print the whole job in "color", costing $16, or manually find the ten color pages, print them separately for 80¢, then print the rest of the document for $1.80, for a total of $2.60, or forego the color pages altogether and just print the whole thing in B&W for $2.

Is there a piece of software than can automatically find the color pages in a print job, send those pages to the color printer, and then print the rest of the job to a B&W printer? What would be ideal is some sort of print filter so that the user could just print the whole job as a color job, and the software would intercept it, chop it up based on which pages were in color, and send each segment to the appropriate printer. I've found PaperCutNG, which does exactly what I want, but, honestly, it's not worth the money for that one feature. I was hoping to find a free solution.

My print server is a Windows 2003 machine, and a solution that runs there would be preferable, but I can transition to a different OS if needed. A client-side solution would also be acceptable.

share|improve this question
add comment

5 Answers

You can create two printers on the server. One set to print Black only and the other colour. You can even add secrity to the colour printer so only approved users can print to thecolour device. One printer that appears as two to the users. Have also used this to set a certain page size or to force Duplex printing.

Have used this often in the past and it works well and costs nothing when running Windows Server 2003

share|improve this answer
    
This answers the wrong question. I want a single job to be split between color and B&W printers, not force my users to not print in color. I've updated the question with a clearer example. –  wfaulk Dec 12 '09 at 4:36
add comment

Check out PDFsam: a free, open source utility for (you guessed it) splitting and merging PDFs. You may be able to script it to get it to do what you want.

share|improve this answer
    
The problem isn't so much doing the splitting as it is determining which pages are color and which aren't, and then automating the task of sending the appropriate pages to the appropriate printer. –  wfaulk Dec 12 '09 at 4:44
add comment

You will need to find a 3rd party print server manager such as papercut which you have mentioned.

Some other solutions could inculde the following server applications, although I don't know if they specificity include what your looking for:

  • Print Manager Plus
  • Printer Peer
  • Netop PrintLimit Pro
  • Equitrack
share|improve this answer
add comment

Okay, it looks like I'm going to have to implement this myself. So far I have a crude perl script (that uses a lot of system calls to ghostscript and netpbm) that determines the color- or black-and-white-ness of each page of a PostScript (or PDF) document:

#!/usr/bin/perl

use File::Temp qw/ tempfile tempdir /;

my $pages=0;

my $tempdir = tempdir(CLEANUP=>1);
my ($psfh, $psfn) = tempfile(SUFFIX=>'.ps', DIR=>$tempdir);

while (<>) {
        # Write to temporary file
        print $psfh $_;
        # Count Pages
        $pages++ if ( /\%\%Page:/ );
}

if ( $pages == 0 ) {
        # Not DSC-conforming; count manually; ugh
}

my ($pdffh, $pdffn) = tempfile(SUFFIX=>'.pdf', DIR=>$tempdir, OPEN=>0);

# Convert to PDF
#print("ps2pdf ... ");
system("ps2pdf $psfn $pdffn");
#print("done\n");

# Count PDF pages
my $pdfpages = `pdfinfo $pdffn | egrep -e '^Pages'`;
$pdfpages =~ m/(\d+)/;
$pdfpages = $1;
#print("$pdfpages pages\n");

# Note: 1-based array!!
my @colorhist;
for ( my $i = 1; $i<=$pdfpages; $i++) {
        print("Page $i\n");
        my @colors = `gs -q -dFirstPage=$i -dLastPage=$i -dNOPAUSE -dBATCH -sDEVICE=ppmraw -sOutputFile=- $pdffn | ppmhist -noheader`;
        foreach (@colors) {
                m/^\s*(\d+)\s+(\d+)\s+(\d+)\s+\d+\s+(\d+)\s*$/;
                my $color = (($1<<16) + ($2<<8) + $3);
                my $instances = $4;
                $colorhist[$i]{$color} = $instances;
                #print "$color $instances\n";
        }
}

my @colorbw;

for ( my $i = 1; $i<=$pdfpages; $i++ ) {
        my %pagehist = %{$colorhist[$i]};
        #print("page $i:\n");
        my $numcolors = 0;
        my $totinstances = 0;
        foreach $key (keys(%pagehist)) {
                #print "$key\n";
                #print "\t$key $pagehist{$key}\n";
                $numcolors++;
                $totinstances += $pagehist{$key};
                my $r = $key >> 16;
                my $g = ( $key - ($r << 16) ) >> 8;
                my $b = $key - ($r << 16) - ($g << 8);
                if ( ( abs($r - $g) > 32 ) || ( abs($r - $b) > 32 ) || ( abs($g - $b) > 32 ) ) {
                        $colorbw[$i] = 2;
                }
        }
        if ( $numcolors <= 2 ) {
                $colorbw[$i] = 1;
        }
        print "$i\n" if ($colorbw[$i] > 1);
}

It has one optimization already, in that if a page contains only two colors, it marks it as B&W, even if one of the colors is nowhere near black, white, or grey. I also need to implement a filter to discard pages that have something like one pixel of another color, and also one to only mark the ones that are excessively color-y, to filter out things in color that happen on every page. (I figure that if someone is going to use this, they're intending to print at least some of the pages in black-and-white.)

After that, I have to implement printing each of those sets through the appropriate queue.

Hopefully I can figure out how to pull the Ghostscript and netpbm stuff back into the script, even if I have to change languages.

share|improve this answer
add comment

wfaulk, how did you get on with this?

we have had this feature working for a long time.

its something that should be done in the print driver itself... changing automatically between mono & colour on the fly.

worth checking what options your manufacturer give you, different drivers perhaps.

As someone posted above, some of the print accounting sofwares do this.. and work out a charge but they are just using the print driver as provided.

share|improve this answer
    
+1 This is what I would have answered - this should be done by the printer itself (perhaps not the driver though) and the bigger volume printers I've seen leased have often had this detection and separation of color and non-color pages built-in, completely automatic and correctly updating the metrics. Having to manually decide this seems like a very old-school trick to exhaust more money out of the users ^^ –  Oskar Duveborn Jul 12 '10 at 12:06
    
It depends on the printer manufacturer. Ricoh, Tally and HP all work. some do work fine at the hardware level, others the driver is definitely part of the mechanism and important - can certainly affect the output & number of pages charged. for example, some applications like IE or Outlook printing an odd number of pages in double sided mode - the driver will force a blank back page. Result - the happy MFD/ print manufacturer getting an extra 2c/2p on potentially millions of pages across their leased devices. –  MartinC Jul 12 '10 at 13:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.