CaseLeaf

Handbook / The `words` command

The words command

Copying a paragraph out of a document produces scrambled text, and it reads perfectly on the page.

Reports where each word sits on the sheet, and which of them are misplaced. The second half is the point: text that is drawn in the wrong order, or at coordinates that do not match what is displayed, reads correctly to a person and wrongly to everything else: search, extraction, read-aloud. Reach for it when copying from a document produces scrambled text.

How you run it

caseleaf words report.pdf

caseleaf words report.pdf --page 1

What each part means

In full, every part it will take:

caseleaf words <file> [--page <n>]
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.
--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, the first sheet.

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.

{
  "misplaced" : 0,
  "page" : 1,
  "which" : [

  ],
  "words" : 21
}

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 "words" on "/path/to/report.pdf"
end tell

tell application "CaseLeaf"
    perform "words" on "/path/to/report.pdf" ¬
        options "--page 1"
end tell

All the commands · Asking from a script · Contents