Flip or rotate pages

The GroupDocs.Viewer enables you to rotate individual pages when viewing documents in HTML/PDF/JPG/PNG formats. To flip/rotate pages use the rotatePage(…) method of ViewOptions class.  The method accepts page number as the first parameter and rotation angle as the second parameter. There are three options that you can pass as the second parameter into rotatePage(…) method:

The following code snippet shows how to rotate output pages when viewing a document as PDF (this example can be also found in our public GitHub repository.)

    Viewer viewer = new Viewer("sample.docx");
    PdfViewOptions viewOptions = new PdfViewOptions();
    viewOptions.rotatePage(1, Rotation.ON_90_DEGREE);

    viewer.view(viewOptions);
    viewer.close();

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full-featured Java library we provide simple but powerful free Apps. You are welcome to view Word, PDF, Excel, PowerPoint documents with free to use online GroupDocs Viewer App.