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.

Install Open Source Feather Icons

Create WhatsApp clone with Next.js Part 7 Sidebar notification

Policies made easy by aex middlewares with fallback

AWS Amplify for React/React Native Development — Pt 1 Setting up your Amplify Environment

An Overview of Next-Generation JavaScript Features for React Apps

Managing ALM integrations in SonarQube via PostMan(Azure DevOps) with example code in

An Introduction to Webpack

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

Why spring boot is the famous framework for developing REST APIs in Java

Build maven project with push to docker hub in same time

AWS EC2 with Spring Boot Java — Part 1

Experience with Spring batch and docker