PDF Rotator

No downloads or installation required!

Rotate a PDF using our free online app or learn how it works with our embedded iText 7 Sandbox.

Use the free online PDF Rotator app

Click the box below to upload a PDF, or drag and drop a PDF into the box.

You can then choose the rotation direction and angle you want. If you have uploaded a PDF with multiple pages, you can choose if you want to rotate a specific page.

Click Rotate PDF and then download the resulting PDF.

Or play in the iText 7 Sandbox

In this Sandbox you can see how the the rotation code works in iText 7, and experiment with changing the code yourself.

Click Upload File and make sure the file name of the PDF you upload matches the name you specify in private static final String ORIG. Then click Execute to run your code. To remove an uploaded file, click the x displayed next to the file name.

You can click the switch at the top of the Sandbox to change between the embedded Java and C# compiler.

import com.itextpdf.kernel.pdf.PdfDocument; import com.itextpdf.kernel.pdf.PdfPage; import com.itextpdf.kernel.pdf.PdfReader; import com.itextpdf.kernel.pdf.PdfWriter; import java.io.IOException; public class PDFRotator { private static final String ORIG = "/uploads/rotate.pdf"; private static final String OUTPUT_FOLDER = "/myfiles/"; private static final int ROTATION_DEGREES = 90; public static void main(String[] args) throws IOException { PdfDocument pdfDocument = new PdfDocument(new PdfReader(ORIG), new PdfWriter(OUTPUT_FOLDER + "Rotated.pdf")); for (int p = 1; p <= pdfDocument.getNumberOfPages(); p++) { PdfPage page = pdfDocument.getPage(p); int rotate = page.getRotation(); if (rotate == 0) { page.setRotation(ROTATION_DEGREES); } else { page.setRotation((rotate + ROTATION_DEGREES) % 360); } } pdfDocument.close(); } }
using iText.Kernel.Pdf; namespace PDFRotator { public class PDFRotator { private static string ORIG = "/uploads/rotate.pdf"; private static string OUTPUT_FOLDER = "/myfiles/"; private static int ROTATION_DEGREES = 90; static void Main(string[] args) { PdfDocument pdfDocument = new PdfDocument(new PdfReader(ORIG), new PdfWriter(OUTPUT_FOLDER + "Rotated.pdf")); for (int p = 1; p <= pdfDocument.GetNumberOfPages(); p++) { PdfPage page = pdfDocument.GetPage(p); int rotate = page.GetRotation(); if (rotate == 0) { page.SetRotation(ROTATION_DEGREES); } else { page.SetRotation((rotate + ROTATION_DEGREES) % 360); } } pdfDocument.Close(); } } }




11,000人以上の購読者に加わって、iTextの新しい製品、アップデート、ヒント、記述的な解決策や出来事に関する最新情報を得ることでiText PDF専門家になりましょう。