GroupDocs.Merger for Java

Move pages in PDF

GroupDocs.Merger for Java empowers Java applications to reorder pages in PDF documents seamlessly.

How to move PDF pages

GroupDocs.Merger allows you to move selected pages in PDF documents. Enhance your Java applications with advanced document processing features.

  1. Specify the source PDF file path.
  2. Set the page number and its new position.
  3. Perform the move operation.
  4. Save the result.
// Create a Merger object by passing the source path
Merger merger = new Merger("document.pdf");

// Specify the page to be moved
int pageNum = 3;
int moveTo = 1;
MoveOptions moveOptions = new MoveOptions(pageNum, moveTo);

// Move the page
merger.movePage(moveOptions);

// Save the processed document
merger.save("result.pdf");
Maven XML
click to copy
copied
More examples Documentation

Efficient document processing

GroupDocs.Merger for Java is designed to provide a comprehensive set of features, enabling you to process over 50 widely used business file formats for your needs.

Key features of GroupDocs.Merger

Combine documents in various formats

Merge content from files like PDFs, Word documents, presentations, spreadsheets, images, archives, and more. Use flexible options to achieve precise results.

Page manipulations

Reposition pages within documents. Move, swap, or remove pages to manage your business document content effectively.

Adjust page appearance

Rotate pages to any angle or switch their orientation between landscape and portrait.

Extract pages into separate files

Extract one or more pages and save them as standalone documents.

Move a page to the end of the document

Learn how to move a specific page to the end of a PDF document.

Java

// Pass the source file path to the constructor
Merger merger = new Merger("document.pdf");

// Get document info and the number of the last page
IDocumentInfo info = merger.getDocumentInfo();

// Set up options with page numbers
int pageNum = 1;
int moveTo = info.getPageCount();
MoveOptions moveOptions = new MoveOptions(pageNum, moveTo);

// Process the document, moving the page to the end
merger.movePage(moveOptions);

// Save the document to a new location
merger.save("result.pdf");
Maven XML
click to copy
copied
More examples Documentation

GroupDocs.Merger Info

GroupDocs.Merger for Java is a powerful document processing tool that supports over 50 file formats, including PDF, Word, Excel, PowerPoint, images, and archives. It offers essential features like merging, splitting, extracting, moving, swapping, and removing pages.
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.

Main features

Discover other popular capabilities of our solution.

Reorder document pages in multiple formats

GroupDocs.Merger supports over 50 file formats, enabling efficient and flexible document manipulation.

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