GroupDocs.Merger for Java

Page rotation in XPS

GroupDocs.Merger for Java extends the capabilities of Java applications. Process documents in popular business formats with features like page rotation in XPS files.

How to rotate XPS pages

With GroupDocs.Merger, you can rotate pages in XPS documents, enhancing document management capabilities in Java applications.

  1. Specify the source path of the XPS file.
  2. Choose the page number to rotate.
  3. Execute the page rotation operation.
  4. Save the modified file to the desired location.
// Create a Merger instance and load the source file
Merger merger = new Merger("document.xps");

// Specify the page number to rotate
RotateMode rotateMode = RotateMode.Rotate180;
RotateOptions rotateOptions = new RotateOptions(rotateMode, new int[] { 1 });

// Perform the page rotation operation
merger.rotatePages(rotateOptions);

// Save the output file to the desired location
merger.save("result.xps");
Maven XML
click to copy
copied
More examples Documentation

Powerful document content management

GroupDocs.Merger for Java provides a comprehensive set of features for processing over 50 popular business file formats efficiently.

Key features of GroupDocs.Merger

Merge various file formats

Combine PDFs, Word documents, presentations, spreadsheets, Visio diagrams, images, and archives. Use customization options for optimal results.

Manage document pages

Rearrange pages by moving, swapping, or deleting them to better organize your content.

Control page layout

Rotate pages to a specific angle or switch between portrait and landscape orientations.

Extract pages as separate files

Select a single page or a range of pages and save them as a new file in a specified location.

Rotate all even-numbered XPS pages

Check out this example demonstrating how to rotate all even-numbered pages in a XPS document.

Java

// Load the source file into the constructor
Merger merger = new Merger("document.xps");

// Retrieve the total number of pages
IDocumentInfo info = merger.getDocumentInfo();
int lastPage = info.PageCount;

// Configure the rotation settings for even pages (180 degrees)
RangeMode rangeMode = RangeMode.EvenPages;
RotateMode rotateMode = RotateMode.Rotate180;
RotateOptions rotateOptions = new RotateOptions(rotateMode, 1, lastPage, rangeMode);

// Apply the page rotation operation
merger.rotatePages(rotateOptions);

// Save the output file
merger.save("result.xps");
Maven XML
click to copy
copied
More examples Documentation

About GroupDocs.Merger

GroupDocs.Merger for Java is a powerful document processing library supporting over 50 file formats, including PDF, Word, Excel, PowerPoint, Visio, images, and archives. It enables merging, splitting, extracting, moving, swapping, and removing pages, enhancing document management in your applications.
Learn more
About illustration

Ready to get started?

Download GroupDocs.Merger for free or get a trial license for full access!

Useful resources

Explore documentation, code samples, and community support to enhance your experience.

Key features

Explore the powerful features provided by our document processing library.

Rotate pages in multiple formats

GroupDocs.Merger supports over 50 file formats, allowing you to modify documents effortlessly with a wide range of operations.

Temporary license tips

1
Sign up with your work email.
Free mail services are not allowed.
2
Use Get a temporary license button on the second step.
 English