Get Started - Load and Edit a PDF File
- 3 minutes to read
Important
You need a license for the DevExpress Office File API Subscription or DevExpress Universal Subscription to use these examples in production code.
This article describes how to get started with the non-visual PDF processing component for .NET Framework and .NET Core.
Create a .NET Framework Application
Run Microsoft Visual Studio and create a new Console Application (.NET Framework) project.
Install the DevExpress.Document.Processor NuGet package or add references to the following libraries (if you have the DevExpress Unified Component Installer installed on your machine):
- DevExpress.Data.v24.1.dll
- DevExpress.Docs.v24.1.dll
- DevExpress.Drawing.v24.1.dll
- DevExpress.Office.v24.1.Core.dll
- DevExpress.Pdf.v24.1.Core.dll
- DevExpress.Pdf.v24.1.Drawing.dll
Paste the code below in the Main method of the Program.cs file (
Main
procedure of theModule1.vb
file for Visual Basic).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"); } } } }
Run the project. After executing the code above, the pages are rotated and the new document is saved to the specified location.
Create a .NET Core Application
Perform the following steps to get started with the non-visual PDF processing component:
Run Microsoft Visual Studio and create a new Console Application (.NET Core) project.
Install the DevExpress.Document.Processor NuGet package.
Paste the code below in the Main method of the Program.cs file (
Main
procedure of theModule1.vb
file for Visual Basic).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"); } } } }
Run the project. After executing the code above, the pages are rotated and the new document is saved to the specified location.