Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Rotate Pages | Manipulating and Combining PDFs
Manipulating and Combining PDFs
course content

Course Content

Manipulating and Combining PDFs

bookRotate Pages

rotate() is a PyPDF2 function that allows developers to rotate the pages of a PDF file by a specified angle. It's useful for correcting orientation issues in PDF files and for generating reports or documents with a specific page orientation.

Let's rotate the first page of the sample.pdf and save the result in the new output.pdf file.

The sample.pdf looks in that way:

Task
test

Swipe to show code editor

  1. Read in a PDF called "sample.pdf";
  2. Select the page at index 0 and rotate it by 90 degrees;
  3. Write the PDf to a file called "output.pdf".

After successful completeon of the task the output.pdf contains:

Mark tasks as Completed
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

rotate() is a PyPDF2 function that allows developers to rotate the pages of a PDF file by a specified angle. It's useful for correcting orientation issues in PDF files and for generating reports or documents with a specific page orientation.

Let's rotate the first page of the sample.pdf and save the result in the new output.pdf file.

The sample.pdf looks in that way:

Task
test

Swipe to show code editor

  1. Read in a PDF called "sample.pdf";
  2. Select the page at index 0 and rotate it by 90 degrees;
  3. Write the PDf to a file called "output.pdf".

After successful completeon of the task the output.pdf contains:

Mark tasks as Completed
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 1. Chapter 5
AVAILABLE TO ULTIMATE ONLY
We're sorry to hear that something went wrong. What happened?
some-alt