CaseLeaf

Handbook / The `link` command

The link command

Two clauses argue with each other and a reader should be able to jump from one to the other without being told where to look.

Points one mark at another, by adding a line to the first mark's own comment - the same line Copy Link to Mark and a paste would make. Use it to connect a clause to the definition it depends on, or an answer to the question it responds to, without leaving the document to look either up again. Nothing is written twice: an address already in the comment adds nothing a second time.

How you run it

caseleaf link report.pdf --page 1 --index 0 --topage 2 --toindex 0

What each part means

In full, every part it will take:

caseleaf link <file> [--mark <id> | --page <n> --index <n>] [--to <id> | --topage <n> --toindex <n>] [--in <other.pdf>]
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.
--mark The first mark, by the identifier marks prints for it - the one whose comment gains the link. Left out, --page and --index together name it instead.
--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. Needed with --index unless you name the mark outright with --mark; either way round names one mark.
--index And which mark on that page, counting from 0.
--to The second mark, by the identifier marks prints for it - the one the link points at. Left out, --topage and --toindex together name it instead.
--topage Or the page it is on, counting from 1.
--toindex And which mark on that page, counting from 0.
--in The document the second mark is in, as a path, when it is not this one. Left out, both marks are looked for in the document you named first.

Each mark's own comment gains a line naming the other — the same line "Copy Link to Mark" and a paste make — and nothing is written twice: an address already in a comment adds nothing.

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.

{
  "from" : {
    "file" : "report.pdf",
    "mark" : "8C7A21E0-0000-4000-8000-000000000000"
  },
  "linked" : true,
  "to" : {
    "file" : "report.pdf",
    "mark" : "8C7A21E0-0000-4000-8000-000000000000"
  }
}

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 "link" on "/path/to/report.pdf" ¬
        options "--page 1 --index 0 --topage 2 --toindex 0"
end tell

All the commands · Asking from a script · Contents