CaseLeaf

Handbook / The `fields` command

The fields command

You have a printed application form as a scan, and you want to see where the software thinks the blanks are before you turn it into something people can type into.

Reports the form fields the application would propose for a document that has none, showing where it thinks the blanks are. It is a reading, not a change: makeform is what writes those fields in. Use this first to see what would be proposed and where it is wrong, because a form with fields in the wrong places is harder to fix than one with none.

How you run it

caseleaf fields report.pdf

caseleaf fields report.pdf --page 1

What each part means

In full, every part it will take:

caseleaf fields <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 the measurements are about, counting from 1: the skew, the panels, the ruled boxes and the rest of what comes back under drawn. Left out, the first. It does not narrow the fields themselves: those are proposed across the whole document however this is set.

For a flat page, without writing any of them.

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" : 2,
  "drawn" : {
    "cellBoxes" : [

    ],
    "cells" : 0,
    "lineBoxes" : 0,
    "longRuns" : 0,
    "panels" : [

    ],
    "paperTone" : 255,
    "ruleBoxes" : [

    ],
  … 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 "fields" on "/path/to/report.pdf"
end tell

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

All the commands · Asking from a script · Contents