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:

import com.groupdocs.viewer.Viewer;
import com.groupdocs.viewer.options.PdfViewOptions;
import com.groupdocs.viewer.options.Rotation;
// ...

try (Viewer viewer = new Viewer("sample.docx")) {
    PdfViewOptions viewOptions = new PdfViewOptions();
    // Rotate the first page.
    viewOptions.rotatePage(1, Rotation.ON_90_DEGREE);


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