So you have a PDF file that might be one or more pages, but you want to rotate the pages? Use these simple steps from your Ubuntu Linux command line terminal:
sudo apt-get install python-pypdf(you need this to modify PDFs with Python)
- Create a text document to contain this python code:
#!/usr/bin/env python import sys from pyPdf import PdfFileWriter, PdfFileReader input = PdfFileReader(sys.stdin) output = PdfFileWriter() for i in range(0,input.getNumPages()): output.addPage(input.getPage(i).rotateClockwise(90)) output.write(sys.stdout)
You can change 90 to -90 to rotate the other direction (left instead of right).
- Save & Close the file as rotatepdf.py
- Run chmod 755 rotatepdf.py to make it executable
./rotatepdf.py < input.pdf > output.pdf
Input.pdf is your original PDF file that is not rotated. Output.pdf is the PDF after rotation is applied (do not use the same filename for both).