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:
- Rotation.On90Degree - instructs to rotate page on 90-degree clockwise;
- Rotation.On180Degree - instructs to rotate page on 180-degree clockwise;
- Rotation.On270Degree - instructs to rotate page on 270-degree clockwise;
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.)
using (Viewer viewer = new Viewer("sample.docx"))
{
PdfViewOptions viewOptions = new PdfViewOptions();
viewOptions.RotatePage(1, Rotation.On90Degree);
viewer.View(viewOptions);
}
More resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Viewer for .NET examples, plugins, and showcase
- GroupDocs.Viewer for Java examples, plugins, and showcase
- Document Viewer for .NET MVC UI Example
- Document Viewer for .NET App WebForms UI Modern Example
- Document Viewer for Java App Dropwizard UI Modern Example
- Document Viewer for Java Spring UI Example
Free Online App
Along with full-featured .NET 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.