Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to rotate pages of PDF file

📅 2013-Sep-22 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ pdf, pdf90, pdftk, rotate ⬩ 📚 Archive

Sometimes, the pages in a PDF file might be rotated wrongly. For example, this can happen as the result of automatic scanning of documents.

Ubuntu 20.04

The pdftk tool can be used to rotate pages of a PDF clockwise or counterclockwise:

$ pdftk in.pdf cat 1-endeast output out.pdf
$ pdftk in.pdf cat 1-endwest output out.pdf

Ubuntu 14.04

To rotate the pages of a PDF file, the pdf90 tool can be used.

First, install the texlive-extra-utils package:

$ sudo apt-get install texlive-extra-utils

Then call pdf90 to rotate the pages of a PDF file by 90 degrees in counterclockwise direction:

$ pdf90 foobar.pdf

The output is written to a file with suffix of -rotated90. For example, foobar.pdf becomes foobar-rotated90.pdf.


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧