Ubuntu – Rotate a specific page of a pdf file

pdf

I have a multi-page pdf file, and I want to rotate a specific page 90 degrees clockwise, to obtain a new pdf file which has the same pages as the original pdf, but with this specific page rotated.
How can I do this?

Best Answer

NOTE: This solution only works for Ubuntu versions up through 17.10. Ubuntu 18.04 and later do not have the pdftk package due to the packages being removed due to the dependencies to run the package being removed from the Archive for Bionic and later.

NOTE2: even if officially removed from 18.04, there is a snap version of pdftk; you can install it with snap install pdftk.

You can use pdftk. Install it with sudo apt-get install pdftk. Then, suppose you want to rotate the page 4 of your document test.pdf 90 degree clockwise:

pdftk test.pdf cat 1-3 4east 5-end output out.pdf 

You can do much more in pdftk, changing page order, rotation, merging various PDF files. The manual page is your friend here.

From man pdftk, referring to the cat operation:

<input PDF handle>[<begin page number>[-<end page num‐ ber>[<qualifier>]]][<page rotation>]

             Where the handle identifies one of the input PDF files, and
             the beginning and ending page numbers are one-based refer‐
             ences to pages in the PDF file.  The qualifier can be even or
             odd, and the page rotation can be north, south, east, west,
             left, right, or down.