CaseLeaf

Handbook / The `rotate` command

The rotate command

Half a scanned bundle came out sideways.

Turns sheets a quarter, a half or three quarters. Scanners produce sideways pages and bundles arrive mixed; this is the fix, applied to the sheets you name rather than all of them.

How you run it

caseleaf rotate report.pdf --by 90

caseleaf rotate report.pdf --by 90 --pages 1,2,3 --to reviewed.pdf

What each part means

In full, every part it will take:

caseleaf rotate <file> --by <degrees> [--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.
--by 90, 180, 270 or -90, clockwise. Anything that is not a quarter is refused.
--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 turn is an attribute the page carries and PDFKit honours, so nothing is drawn again and nothing is lost. Turning a sheet over is flip, which is a different act.

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.

{
  "by" : 90,
  "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 "rotate" on "/path/to/report.pdf" ¬
        options "--by 90"
end tell

tell application "CaseLeaf"
    perform "rotate" on "/path/to/report.pdf" ¬
        options "--by 90 --pages 1,2,3 --to reviewed.pdf"
end tell

All the commands · Asking from a script · Contents