Rearrange PDF Pages Using Java

Import JAR Dependency


Sample Code

import com.spire.pdf.PdfDocument;

public class RearrangePages {

public static void main(String[] args) {

//Create a PdfDocument object
PdfDocument doc = new PdfDocument();

//Load the sample PDF file

//Rearrange pages by setting a new page order
doc.getPages().reArrange(new int[]{0, 2, 1, 3});

//Save to file




Sharing Java Code

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Exemplo de alternativa ao switch case no Typescript.


How to Use IBM’s Carbon Design System (React) to Create a Quick UI

Explore espeak-ng Command in linux……..

TLDR: Angular Route Resolvers

Understanding Node.js for application development

Managing Azure DevOps Pats for technical users via NodeJs and PostMan

Create a Deno Rest API: A promising start with Alosaur and TypeORM

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andrew Wilson

Andrew Wilson

Sharing Java Code

More from Medium

How to: Log4J2 and Graylog in a Spring Boot application

How to Merge Two Word DocX Documents Together using Java

FullStack Web Application—Springboot Project (Part 1: Back-end)

JAVA & Git-Hub