#!/usr/bin/perl
# print an a4 page of ppm in colour
$tmppref = "/tmp/cpva-col$$";

# This is tuned for general purpose use, such as printing pages
# from netscape, in that -solidblack is used to get black text
# printed as black. It would be nice to print K first, so that
# something is printed during the computation time (since for netscape pages,
# black will probably predominate). However, with -solidblack, it's important
# to print K last, otherwise there is too sharp a constrast between
# dark brown and black.
open(CYAN,"|ppmtocpva  -xshift -3.4mm -yshift -12mm -pageC -halftone -solidblack");
open(MAGENTA,"|ppmtocpva  -xshift -3.4mm -yshift -12mm -pageM -halftone -solidblack >$tmppref.MAGENTA");
open(YELLOW,"|ppmtocpva  -xshift -3.4mm -yshift -12mm -pageY -halftone -solidblack >$tmppref.YELLOW");
open(BLACK,"|ppmtocpva  -xshift -3.4mm -yshift -12mm -pageK -halftone -solidblack >$tmppref.BLACK");

while ( $n = read(STDIN,$data,1024) ) {
 print BLACK $data;
 print CYAN $data;
 print MAGENTA $data;
 print YELLOW $data;
}
close(BLACK);
close(CYAN);
close(MAGENTA);
close(YELLOW);
system("cat $tmppref.MAGENTA $tmppref.YELLOW $tmppref.BLACK");
unlink("$tmppref.MAGENTA","$tmppref.YELLOW","$tmppref.BLACK");

