CaseLeaf

Handbook / The `flip` command

The flip command

A batch was photographed through the back of the page.

Turns sheets over, left to right or top to bottom. It is for material that was scanned or photographed through the back of the page, and for the occasional document assembled mirror-imaged.

How you run it

caseleaf flip report.pdf --axis horizontal

caseleaf flip report.pdf --axis horizontal --pages 1,2,3 --to reviewed.pdf

What each part means

In full, every part it will take:

caseleaf flip <file> --axis horizontal|vertical [--pages 1,2,3] [--to <output>]
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. This command writes to it unless you send the result somewhere else with --to.
--axis Which way to turn the sheets over: horizontal mirrors left to right, vertical top to bottom. There is no default: say which.
--pages Which sheets, as numbers or ranges separated by commas, so 1,3,5-7 is five sheets. Every command reads that spelling the same way, and a number the document does not have is refused rather than skipped.
--to Where to write the result, as a path. The shape above shows which format this command writes. Left out, the document you named is rewritten where it stands, because --to chooses where, not whether. Give one to keep the original.

A flip is not a rotation. A page's turn is an attribute it carries and a mirror image is not, so a flipped sheet is drawn again through a reversed transform and put in the old one's place. It keeps its size and its rotation, and the marks on it are turned over with it and stay marks.

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.

{
  "axis" : "horizontal",
  "sheets" : [
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8
  ],
  "to" : "report.pdf",
  "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 "flip" on "/path/to/report.pdf" ¬
        options "--axis horizontal"
end tell

tell application "CaseLeaf"
    perform "flip" on "/path/to/report.pdf" ¬
        options "--axis horizontal --pages 1,2,3 --to reviewed.pdf"
end tell

All the commands · Asking from a script · Contents