There are times when you will need to stamp a document as a draft. That is, you will want to mark the document so that no one can mistake it for a finished document, but you do not want to make it illegible. Watermarks are perfect for this task.

A watermark is any marking which appears behind the text of the page and is generally quite light in apprearence. The main text of the page should be legible above it, and the watermark should be visible beneath.

The PostScript

The PostScript for generating a watermark is quite simple. After each %%Page: comment (and before the actual PostScript code for the page, you should insert the code to draw the watermark (safely wrapped between a gsave and grestore pair.

As a concrete example, let us say we want to print the word "Draft" down the page beneath the actual text of the page. Such a watermark would be suitable for printing drafts of documents.

Here is the PostScript code to print the watermark:

 .75 setgray
 /Helvetica-Bold findfont 72 scalefont setfont
 80 80 800 {
  306 exch moveto                      % move to the center of the line
  (Draft) dup
  stringwidth pop 2 div neg 0 rmoveto  % Center the text horizontally
  show                                 % Show the text
 } for                                 % and keep doinging it

The Hard Part

The hard part of the job is to find the pages. Fortunately, we can use the same technique we used for the galley proofs. Actually, our requirements are simpler. We do not need to wrap the original page code in a gsave, grestore pair, as we did before.

And here is the PERL script to do the job:

$flag = 0;
while (<>) {
    if (/^%%Page:/) {
        if ($flag) {
            print "grestore\n";
        $flag = 1;
        print $_;
        print "gsave\n";
        print ".75 setgray\n";
        print "/Helvetica-Bold findfont 72 scalefont setfont\n";
        print "80 80 800 { 306 exch moveto\n";
        print "(Draft) dup\n";
        print "stringwidth pop 2 div neg 0 rmoveto show } for\n";
        print "grestore\n";
    } else {

[ Previous Page ] [ Main Page ]

pjw 12/21/96