←Select platform

RotatePages Method


Rotates one or more pages with the specified value.

public void RotatePages( 
   IEnumerable<int> pageNumbers, 
   int angle 
Public Sub RotatePages( 
   ByVal pageNumbers As IEnumerable(Of Integer), 
   ByVal angle As Integer 
   void RotatePages( 
      IEnumerable<Int32>^ pageNumbers, 
      Int32 angle 



Page numbers to rotate. This should be one or more item with 1-based page numbers. Use null to rotate all the pages in the document viewer.


Angles in degrees. Must be in 90 degrees increment. The rotation is performed clockwise for positive values and counter-clockwise for negative values.


This method performs the following:

For each page number specified in pageNumbers.

  1. Finds the corresponding DocumentPage object and calls the DocumentPage.Rotate method.

  2. Rotates the corresponding AnnContainer if any.

  3. Resets the text of the page.

The Operation event will occur for each page with the DocumentViewerOperation set to PageRotate.


Start with the example created in DocumentViewer, remove all the code in the Example function and add the code below.

When the user clicks the Example button, we rotate the current active page by 90 degrees. Clicking the example button again will rotate the page by another 90 degrees.

using Leadtools; 
using Leadtools.Controls; 
using Leadtools.Document; 
using Leadtools.Document.Viewer; 
using Leadtools.Codecs; 
using Leadtools.Caching; 
using Leadtools.Annotations.Engine; 
using Leadtools.Ocr; 
int pageNumber = _documentViewer.CurrentPageNumber; 
_documentViewer.RotatePages(new int[] { pageNumber }, 90); 
Imports Leadtools 
Imports Leadtools.Controls 
Imports Leadtools.Document 
Imports Leadtools.Document.Viewer 
Imports Leadtools.Codecs 
Imports Leadtools.Caching 
Imports Leadtools.Annotations.Engine 
Imports Leadtools.Ocr 
Dim pageNumber As Integer = _documentViewer.CurrentPageNumber 
_documentViewer.RotatePages(New Integer() {pageNumber}, 90) 

Help Version 21.0.2020.9.23
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document.Viewer.WinForms Assembly