usmanazizgroupdocs
4/15/2016 - 10:34 AM

RotatePageToNintyDegreeInImageMode.java

// For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Java
try {
	// Setup GroupDocs.Viewer config
	ViewerConfig config = Utilities.getConfiguration();
	// Create image handler
	ViewerImageHandler imageHandler = new ViewerImageHandler(config);
	String guid = fileName;

	// Set rotation angle for page number 3
	RotatePageOptions rotateOptions = new RotatePageOptions(3, rotationAngle);

	// Perform page rotation
	imageHandler.rotatePage(guid, rotateOptions);

	// Set image options to include Rotate transformations
	ImageOptions imageOptions = new ImageOptions();
	imageOptions.setTransformations(Transformation.Rotate);

	List<PageImage> pages = imageHandler.getPages(guid, imageOptions);

	for (PageImage page : pages) {
		Utilities.saveAsImage(page.getPageNumber() + "_" + fileName, "png", page.getStream());
	}
} catch (Exception exp) {
	System.out.println("Exception: " + exp.getMessage());
	exp.printStackTrace();
}