Skip to main content
A newer version of this page is available. .

How to: Rotate Pages

Important

You require a license to the DevExpress Office File API or DevExpress Universal Subscription to use these examples in production code. Refer to the DevExpress Subscription page for pricing information.

This example illustrates how to use the PDF Document API component to rotate pages.

Note

A complete sample project is available at https://github.com/DevExpress-Examples/how-to-rotate-pdf-pages-t114305

using DevExpress.Pdf;

namespace PdfPageRotationExample
{

    class Program {
        static void Main(string[] args)
        {
            using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
            {
                pdfDocumentProcessor.LoadDocument("..\\..\\docs\\TextRotate.pdf");
                int angle = 0;
                foreach (PdfPage page in pdfDocumentProcessor.Document.Pages) {
                    angle = (angle + 90) % 360;
                    page.Rotate = angle;
                }
                pdfDocumentProcessor.SaveDocument("..\\..\\docs\\Rotated.pdf");
            }
        }
    }
}
See Also