CaseLeaf

Handbook / The `mark` command

The mark command

The same phrase has to be highlighted in ninety contracts, the same way in each.

Draws a mark: a highlight over words you name, a shape at coordinates you give, a line, or a note. It is what a reviewer does by hand, done from a script instead, and the reason it is worth having on the command line is volume: the same highlight across ninety documents, applied the same way each time.

How you run it

caseleaf mark report.pdf --kind highlight --find "force majeure"

caseleaf mark report.pdf --kind highlight --find "force majeure" --page 1 --color #ffd54a --as Reviewer --unlock

caseleaf mark report.pdf --kind rectangle --page 1 --bounds 72,540,180,24

caseleaf mark report.pdf --kind rectangle --page 1 --bounds 72,540,180,24 --color #ffd54a --unlock

caseleaf mark report.pdf --kind line --page 1 --from 72,540 --to 300,540

caseleaf mark report.pdf --kind line --page 1 --from 72,540 --to 300,540 --color #ffd54a --unlock

caseleaf mark report.pdf --kind note --page 1 --at 72,540 --text "force majeure"

caseleaf mark report.pdf --kind note --page 1 --at 72,540 --text "force majeure" --color #ffd54a --unlock

What each part means

In full, every part it will take:

caseleaf mark <file> --kind highlight --find <text> [--page <n>] [--color #RRGGBB] [--as <name>] [--unlock]
caseleaf mark <file> --kind rectangle|oval --page <n> --bounds x,y,w,h [--color #RRGGBB] [--unlock]
caseleaf mark <file> --kind line --page <n> --from x,y --to x,y [--color #RRGGBB] [--unlock]
caseleaf mark <file> --kind note --page <n> --at x,y --text <text> [--color #RRGGBB] [--unlock]
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. This command writes to it, so keep a copy if the original matters.
--kind What to draw: highlight over words you name, rectangle or oval at a rectangle you give, line between two points, note at one. Each kind takes different parts, listed above.
--find The words to look for, in quotation marks if they contain a space, as in --find "force majeure". Case is ignored, and every occurrence is acted on, not just the first.
--page Which sheet, counting from 1, so --page 4 is the fourth sheet as it sits in the file, whatever number is printed on it. Left out, every sheet.
--color The colour, as hexadecimal digits, such as #ffd54a or ffd54a, since the # is optional. Six digits are red, green and blue; eight add how solid it is, #ffd54a80 being half through. Left out, a highlighter's yellow.
--as Whose name the mark is made in, as in --as Reviewer. Left out, whoever this machine belongs to, unless writing names has been turned off in Settings, and then the mark carries none.
--unlock Take the document's protection off first, when it refuses marks. It cannot be put back on, because the owner password that set it is not in the file, so work on a copy.
--bounds The rectangle, as four numbers: distance from the left, distance from the bottom, width, height, all in points, 72 to the inch. 72,540,180,24 is a box an inch in from the left, near the top of an A4 sheet. Commas, semicolons or spaces all separate them, and since a semicolon ends a command in most shells, that spelling wants quoting: --bounds "72;540;180;24".
--from Where a line starts, as x,y in points from the foot of the sheet, for example 72,540.
--to Where the line ends, as x,y in points from the foot of the sheet, for example 300,540. This one is a point and not a destination; mark writes into the document you named.
--at Where a note sits, as x,y in points from the foot of the sheet, for example 72,540. The note is an icon, so this is a point rather than a rectangle.
--text What a note says, in quotation marks, for example --text "Ask counsel about scope". Only --kind note uses it.

--color #RRGGBB chooses its colour.

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.

{
  "marks" : [
    {
      "index" : 4,
      "page" : 1
    },
    {
      "index" : 0,
      "page" : 2
    }
  ],
  "written" : true
}

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 "mark" on "/path/to/report.pdf" ¬
        options "--kind highlight --find \"force majeure\""
end tell

tell application "CaseLeaf"
    perform "mark" on "/path/to/report.pdf" ¬
        options "--kind rectangle --page 1 --bounds 72,540,180,24"
end tell

tell application "CaseLeaf"
    perform "mark" on "/path/to/report.pdf" ¬
        options "--kind line --page 1 --from 72,540 --to 300,540"
end tell

tell application "CaseLeaf"
    perform "mark" on "/path/to/report.pdf" ¬
        options "--kind note --page 1 --at 72,540 --text \"force majeure\""
end tell

All the commands · Asking from a script · Contents