Rotate all pages of PDF from command line in OS X?

3

Is there any way to rotate PDF pages from the command line in in OS X?

akxlr

Posted 2016-01-14T09:11:39.940

Reputation: 243

Answers

2

Sejda's command line can help rotate PDF pages.

./bin/sejda-console rotate --rotation 90 --files /tmp/file.pdf --output /tmp --pageSelection 4,12-14

Open source project, free, I'm one of the developers.

Edi

Posted 2016-01-14T09:11:39.940

Reputation: 532

1Not in homebrew. :-( – Mitar – 2016-12-16T00:20:36.553

1

This can be achieved by using pdf90, pdf180 or pdf270, which are all part of pdfjam. The latter comes with mactex. You can install it with homebrew cask, by brew cask install mactex. To rotate the PDF document.pdf 90 degrees anticlockwise, use:

pdf90 document.pdf

This will create a file document-rotated90.pdf. See also this answer.

ttq

Posted 2016-01-14T09:11:39.940

Reputation: 531

Installing MacTeX to rotate a PDF may be an overkill... – Alexey – 2018-11-21T16:53:09.330

0

Check out qpdf. From the manual:

--rotate=[+|-]angle[:page-range]

Apply rotation to specified pages. The page-range portion of the option value has the same format as page ranges in Section 3.4, “Page Selection Options”. If the page range is omitted, the rotation is applied to all pages. The angle portion of the parameter may be either 90, 180, or 270. If preceded by + or -, the angle is added to or subtracted from the specified pages' original rotations. Otherwise the pages' rotations are set to the exact value. For example, the command qpdf in.pdf out.pdf --rotate=+90:2,4,6 --rotate=180:7-8 would rotate pages 2, 4, and 6 90 degrees clockwise from their original rotation and force the rotation of pages 7 through 9 to 180 degrees regardless of their original rotation, and the command qpdf in.pdf out.pdf --rotate=180 would rotate all pages by 180 degrees.

Alexey

Posted 2016-01-14T09:11:39.940

Reputation: 857