CaseLeaf

Handbook / The `fillform` command

The fillform command

The same engagement letter has to go out to sixty clients with sixty different sets of details in it.

Writes answers into a form and saves the result as a new document. It is the other half of answers: one reads a filled form, this fills an empty one. Use it to produce many copies of the same form with different answers, which is the case that makes it worth automating at all.

How you run it

caseleaf fillform report.pdf --to reviewed.pdf --from answers.csv

What each part means

In full, every part it will take:

caseleaf fillform <file> --to <output> --from <answers.csv>
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.
--to Where to write the result, as a path. The shape above shows which format this command writes. This command needs it, and writes only there: the document you named is left exactly as it was.
--from The answers, as a two-column file: field name, then value, one per line, such as party_name,Acme Holdings. The names are the ones answers prints for a document of this kind, and what answers --to writes goes straight back in. Its field,value heading is recognised and skipped.

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.

{
  "filled" : 1,
  "offered" : 1,
  "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 "fillform" on "/path/to/report.pdf" ¬
        options "--to reviewed.pdf --from answers.csv"
end tell

All the commands · Asking from a script · Contents