Add a Page to Odd-Page PDFs with Acrobat JavaScript
Question details
Add a page to a PDF only when its page count is odd, using an Acrobat Action Wizard script.

- Product
- Adobe Acrobat Pro Action Wizard
- Device & OS
- not provided
- Scenario
- An Acrobat action needs to make PDF page counts even by appending a page when necessary.
- Observed behavior
- PDFs with an odd number of pages receive one additional page; PDFs with an even number remain unchanged.
Open Adobe Acrobat Pro and check that Action Wizard is available. Make sure the PDFs you plan to process allow page insertion.
Add a conditional page-insertion script to an Acrobat action
Use this script in Action Wizard to append a page only when a PDF has an odd page count.
The modulus operator checks the remainder after dividing the page count by two. A remainder of 1 means the count is odd.
In Acrobat Pro, open Tools > Action Wizard and select New Action.
Add Execute JavaScript to the action, open its settings, and enter: if (this.numPages % 2 == 1) { this.newPage(); }
Add a Save step, save the action, and run it on the PDFs you want to process. Check the output page counts.

Add a Blank PDF Page Manually in WPS Office
WPS Office provides a manual alternative for making an individual PDF's page count even. Check its page count and insert a blank page if the count is odd; this does not automate an Acrobat Action Wizard script.
- 1. Open the PDF: Open WPS Office and select Open to load your PDF.
- 2. Check the page count: Look at the total page count in the PDF viewer. Continue only if the total is odd.
- 3. Insert a blank page: Open the PDF page-management tools, select Insert Blank Page, and place the new page at the end. Menu names may vary by version.
- 4. Save the PDF: Select Save or Save As, then verify that the total page count is even.

Frequently Asked Questions
What does the modulus check do in the Acrobat script?
The expression this.numPages % 2 returns the remainder after dividing the page count by two. A result of 1 means the PDF has an odd number of pages.
Will the script change a PDF that already has an even number of pages?
No. The condition is false for an even page count, so this.newPage() is not called.
Where is the new page added?
With no arguments, this.newPage() adds a page at the end of the PDF.
Can I run this check on multiple PDFs?
Yes. Add the Execute JavaScript and Save steps to an Acrobat Pro Action Wizard action, then run the action on the selected PDFs.
Can WPS Office run the Acrobat Action Wizard script?
The WPS method described here is manual: check the page count and use the PDF page-management tools to insert a blank page when needed. It is not an Acrobat Action Wizard script.




