Rotates this page by the specified angle.
public void Rotate(int angle)
Public Sub Rotate(ByVal angle As Integer)
public:void Rotate(Int32 angle)
angle
Rotation angle in degrees. Positive values will rotate the page clockwise and negative values will rotate the page counter-clockwise. Must be in increment of 90 degrees.
This method changes the value of ViewPerspective based on the previous value and angle.
Refer to Document Page Transformation for more information.
This example will load a document, rotates and flips a couple of pages before exporting it to a new PDF.
using Leadtools;using Leadtools.Codecs;using Leadtools.Document.Writer;using Leadtools.Svg;using LeadtoolsExamples.Common;using Leadtools.Document;using Leadtools.Caching;using Leadtools.Annotations.Engine;using Leadtools.Ocr;using Leadtools.Barcode;using Leadtools.Document.Converter;public static void DocumentPageRotateExample(){var documentUri = new Uri("https://demo.leadtools.com/images/pdf/leadtools.pdf");string documentFile = Path.Combine(ImagesPath.Path, "PagesModified.pdf");// Load this documentvar loadDocumentOptions = new LoadDocumentOptions();using (var document = DocumentFactory.LoadFromUri(documentUri, loadDocumentOptions)){// Documents are read-only by default and we cannot modify them. Fix thatdocument.IsReadOnly = false;DocumentPage page;// This document has 5 pages// Rotate the page by 90 degrees clockwisepage = document.Pages[0];page.Rotate(90);// Flip the second page verticallypage = document.Pages[1];page.Flip();// Delete the third pagepage = document.Pages[2];page.IsDeleted = true;// we will save it as a new PDF, this file should contain 4 pages with the first rotated by 90 and the second flipped verticallyusing (var documentConverter = new DocumentConverter()){var jobData = new DocumentConverterJobData();// The loaded document is our inputjobData.Document = document;// We want PDF as outputjobData.DocumentFormat = DocumentFormat.Pdf;// Into this filejobData.OutputDocumentFileName = documentFile;var job = documentConverter.Jobs.CreateJob(jobData);documentConverter.Jobs.RunJob(job);}}// Show the resultProcess.Start(documentFile);}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.Document.WriterImports Leadtools.SvgImports Leadtools.DocumentImports Leadtools.CachingImports Leadtools.Annotations.EngineImports Leadtools.BarcodeImports Leadtools.OcrImports LeadtoolsDocumentExamples.LeadtoolsExamples.CommonImports Leadtools.Document.ConverterPublic Shared Sub DocumentPageRotateExample()Dim documentUri As New Uri("https://demo.leadtools.com/images/pdf/leadtools.pdf")Dim documentFile As String = Path.Combine(ImagesPath.Path, "PagesModified.pdf")' Load this documentDim loadDocumentOptions As New LoadDocumentOptions()Using document As LEADDocument = DocumentFactory.LoadFromUri(documentUri, loadDocumentOptions)' Documents are read-only by default And we cannot modify them. Fix thatdocument.IsReadOnly = FalseDim page As DocumentPage' This document has 5 pages' Rotate the page by 90 degrees clockwisepage = document.Pages(0)page.Rotate(90)' Flip the second page verticallypage = document.Pages(1)page.Flip()' Delete the third pagepage = document.Pages(2)page.IsDeleted = True' we will save it as a New PDF, this file should contain 4 pages with the first rotated by 90 And the second flipped verticallyUsing documentConverter As New DocumentConverter()Dim jobData As New DocumentConverterJobData()' The loaded document Is our inputjobData.Document = document' We want PDF as outputjobData.DocumentFormat = DocumentFormat.Pdf' Into this filejobData.OutputDocumentFileName = documentFileDim job As DocumentConverterJob = documentConverter.Jobs.CreateJob(jobData)documentConverter.Jobs.RunJob(job)End UsingEnd Using' Show the resultProcess.Start(documentFile)End Sub
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
