CaseLeaf

Handbook / The `inventory` command

The inventory command

A document came back from an external converter and you need to know whether anything was lost on the way.

Lists everything the document carries. Given a second document, it lists what a copy has gained or lost instead. The second form is the one that earns it: a document that has been through another application, a conversion, or a round trip can quietly shed or add attachments, marks or fields, and comparing what came out against what went in is the only way to notice. Reach for it after any step you did not control.

How you run it

caseleaf inventory report.pdf

caseleaf inventory report.pdf --against copy.pdf

What each part means

In full, every part it will take:

caseleaf inventory <file> [--against <copy>]
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.
--against What this document became, as a path, such as converted.pdf. The file you name here is read as the later copy, and the one you gave the command is the earlier. What comes back is what was gained and what was lost between them, which is the question worth asking after a conversion.

Pages, form fields, widgets, attachments, bookmarks, page labels, the XMP packet, the structure tree. With --against, what the copy dropped or gained, and exit 2 if anything did.

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.

{
  "annotations" : 4,
  "annotationsByPage" : [
    4,
    0,
    0,
    0,
    0,
    0,
    0,
    0
  ],
  … 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 "inventory" on "/path/to/report.pdf"
end tell

tell application "CaseLeaf"
    perform "inventory" on "/path/to/report.pdf" ¬
        options "--against copy.pdf"
end tell

All the commands · Asking from a script · Contents