CaseLeaf

Handbook / The `watermark` command

The watermark command

A draft is circulating and somebody has already printed a copy and treated it as final.

Puts a watermark on every sheet, or takes one off. It is for the state a document is in rather than what it says: draft, confidential, superseded, and for making that state visible on every page somebody might print. It can be removed again, which is the difference between this and burning it in.

How you run it

caseleaf watermark report.pdf --to reviewed.pdf

caseleaf watermark report.pdf --to reviewed.pdf --text DRAFT --picture Reviewer --place centre --size 180 --opacity 0.8 --clear

What each part means

In full, every part it will take:

caseleaf watermark <file> --to <output> [--text <word>] [--picture <name>] [--place <where>] [--size <points>] [--opacity <0-1>] [--clear]
part what it is for
<file> The PDF to work on, as a path, such as report.pdf beside you, or the full path to it. It is read and not written.
--to Where to write the result, as a path. The shape above shows which format this command writes. This command needs it, and writes only there: the document you named is left exactly as it was.
--text The word to stamp, DRAFT if left out. It may carry {date}, {time}, {name} and {page}, filled in as the stamp is made. --text "DRAFT - {date}, page {page}" numbers every sheet as it goes. Ignored when --picture is given, because a watermark says one thing.
--picture A picture to stamp instead of a word, as a path. Give both this and --text and the picture is what gets stamped; the words are ignored rather than refused.
--place Where on the sheet, one of nine: topLeft, topCentre, topRight, left, centre, right, bottomLeft, bottomCentre, bottomRight. centre if left out. It is a share of the sheet rather than a measurement, so a bundle of mixed paper sizes stamps in the same place throughout.
--size How large the word is drawn, in points, 36 if left out, about half an inch tall. It is a ceiling rather than a measurement: a stamp too long for the sheet is brought down until it fits on one line, as far as 6 points.
--opacity How solid, above 0 and up to 1, where 1 is opaque. 0.25 is faint enough to read through, and 0 itself is refused rather than stamping nothing.
--clear Take an existing watermark off instead of putting one on, for example caseleaf watermark report.pdf --to clean.pdf --clear. Only a watermark this application put there is recognised; one burnt into the page by something else is part of the page now and stays.

What comes back

Asked of a short sample document, it answers as below. The sample has eight sheets, a highlight and a note left by a reviewer, a web link, a small table, two pictures and one form field already filled in.

{
  "cleared" : false,
  "pages" : 8,
  "wrote" : "reviewed.pdf"
}

The same thing from AppleScript

Everything above can be asked for from a script instead. There is one AppleScript command, perform: on names the document, and options takes the rest exactly as you would type it.

tell application "CaseLeaf"
    perform "watermark" on "/path/to/report.pdf" ¬
        options "--to reviewed.pdf"
end tell

tell application "CaseLeaf"
    perform "watermark" on "/path/to/report.pdf" ¬
        options "--to reviewed.pdf --text DRAFT --picture Reviewer --place centre --size 180 --opacity 0.8 --clear"
end tell

All the commands · Asking from a script · Contents