Rotate pages

Flip or rotate pages

To rotate a page when rendering document, use the RotatePage method of the ViewOptions class. This method has the following two parameters:

  1. page number
  2. rotation angle

The rotation angle is one of the following:

The following code snippet shows how to rotate output pages when rendering a document as PDF:

using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
// ...

using (Viewer viewer = new Viewer("sample.docx"))
{
    // Create a PDF file.
    PdfViewOptions viewOptions = new PdfViewOptions();
    // Rotate the first page.
    viewOptions.RotatePage(1, Rotation.On90Degree);
    viewer.View(viewOptions);
}
Imports GroupDocs.Viewer
Imports GroupDocs.Viewer.Options
' ...

Module Program
    Sub Main(args As String())
        Using viewer As Viewer = New Viewer("sample.docx")
            ' Create a PDF file.
            Dim viewOptions As PdfViewOptions = New PdfViewOptions()
            ' Rotate the first page.
            viewOptions.RotatePage(1, Rotation.On90Degree)
            viewer.View(viewOptions)
        End Using
    End Sub
End Module

You can also view the example in our public GitHub repository .