The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.

Getting Started

  • 3 min to read
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.

Perform the following steps to get started with the non-visual PDF processing component:

  1. Run Microsoft Visual Studio and create a new Console Application (Net Framework) project.

  2. Right-click References in the Solution Explorer and select Add Reference... in the invoked context menu.

    pdf-doc-processor-add-reference

  3. Add references to the following libraries:

    • DevExpress.Data.v19.1;
    • DevExpress.Docs.v19.1;
    • DevExpress.Pdf.v19.1.Core;
    • DevExpress.Pdf.v19.1.Drawing.
  4. Paste the code below in the Main method of the Program.cs file (Main procedure of the Module1.vb file for Visual Basic).

    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");
                }
            }
        }
    }
    
  5. Run the project. After executing the code above, the pages are rotated and the new document is saved to the specified location.

pdf-doc-processor-rotate

  1. Run Microsoft Visual Studio and create a new Console Application (Net Core) project.

  2. Install the DevExpress.Document.Processor NuGet package.

  3. Paste the code below in the Main method of the Program.cs file (Main procedure of the Module1.vb file for Visual Basic).

    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");
                }
            }
        }
    }
    
  4. Run the project. After executing the code above, the pages are rotated and the new document is saved to the specified location.

pdf-doc-processor-rotate

See Also