How to Reorder PDF Pages with an Acrobat JavaScript Script
Question details
The user needs to automate the reordering of scanned microfiche PDF pages from a row-by-row arrangement to a column-by-column sequence.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Reorganizing the layout sequence of batched scanned documents.
- Observed behavior
- Pages are incorrectly ordered by rows instead of columns and require programmatic repositioning across multiple files using a script.
Ensure you have Adobe Acrobat Pro installed, as standard free PDF readers do not support executing document-level JavaScript for structural file modifications.
Automate Page Reordering using Acrobat JavaScript
Use the Acrobat JavaScript API and the movePage method to programmatically change the sequence of your document pages based on a custom defined array.
Acrobat JavaScript allows you to automate repetitive tasks across multiple files. The movePage method is particularly useful for resequencing pages that were scanned out of order, such as microfiche files.
To accomplish this, you must write a script that stores your target page order in an array, then loops through the array while calling the this.movePage() function.
Open Adobe Acrobat Pro, navigate to the Tools menu, select 'JavaScript', and open the 'JavaScript Debugger' or Action Wizard.
Write an array in your script that maps the current row-by-row page indices to the new column-by-column order.
Create a loop that iterates through your array and applies the 'this.movePage(nPage, nInsertAt)' method, moving each page to its intended index.
Run the script on your active document. To apply this to multiple files, save the script as an Action in the Action Wizard and run it across your target folder.

Reorder PDF Pages Instantly with WPS PDF
If writing custom JavaScript scripts is too complex or time-consuming, WPS Office provides an intuitive visual interface to rearrange, extract, and organize PDF pages without writing a single line of code.
- 1. Open your PDF: Launch WPS Office and open your scanned PDF document.
- 2. Navigate to the Page tab: Click on the 'Page' tab located in the top navigation ribbon.
- 3. Select Page Organize: Click on 'Organize Pages' to view all pages as visual thumbnails.
- 4. Drag and drop to reorder: Click and hold the thumbnails, then drag them into your preferred column-by-column layout.
- 5. Save the changes: Click 'Save' or press Ctrl+S to finalize the new page sequence in your document.

Frequently Asked Questions
Can I run Acrobat JavaScript in free PDF readers?
No, advanced script execution that modifies document structure, such as moving or deleting pages, typically requires Adobe Acrobat Pro. Free readers lack the necessary API permissions to modify page geometry.
What is the movePage method in Acrobat JavaScript?
The movePage method is a built-in Acrobat JavaScript function that allows a script to change a page's position within a document. It requires parameters specifying the page you want to move and the index where it should be placed.
Is there a way to batch reorder PDF pages without coding?
While automated batch processing across hundreds of files usually requires scripting or Action Wizard macros, dedicated PDF editors like WPS PDF allow you to quickly visualize and manually drag-and-drop entire sequences of pages without any coding.




