CaseLeaf

Handbook / The `tables` command

The tables command

The table you pulled off a financial appendix came out with the columns in the wrong places, and you want to see where something else thinks the cells are.

Finds where the cells of a table are on each sheet, as the system's own reading of the document sees them: one rectangle per cell. A PDF has no idea it contains a table; the rows and columns are lines and text that happen to line up, and every way of reading them back out is guesswork that has to be checkable.

It answers in the same shape as fields and boxes, and the three are meant to be set against each other: this is a second opinion, not the reading table uses. table works from where the words sit, so the two will not always agree, and where they disagree is exactly what is worth looking at before either answer becomes a spreadsheet.

How you run it

caseleaf tables report.pdf

What each part means

In full, every part it will take:

caseleaf tables <file>

The document, and nothing else.

One rectangle per cell, in the shape fields uses. A second opinion on where a table is, not the reading table extracts with.

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.

{
  "count" : 6,
  "fields" : [
    {
      "height" : 23.856669008731842,
      "label" : "",
      "name" : "cell",
      "page" : 1,
      "width" : 198.13498038798571,
      "x" : 73.500000052154064,
      "y" : 576.06833600997925
    },
  … and the rest of the answer

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

All the commands · Asking from a script · Contents