How to Insert a Blank Page at the Beginning of a PDF with Acrobat JavaScript
Question details
The user needs to insert a blank page at the very beginning of one or multiple PDF documents using a script, ensuring the new blank page matches the exact dimensions of the existing first page.

- Product
- Adobe Acrobat Pro
- Device & OS
- not provided
- Scenario
- Batch processing multiple PDFs to automate the addition of a properly sized blank cover page.
- Observed behavior
- The goal is to successfully automate the insertion of a precisely sized blank first page using Adobe's Action Wizard and JavaScript capabilities.
Ensure you have Adobe Acrobat Pro installed, as the standard free Acrobat Reader does not support the Action Wizard or advanced JavaScript execution for document manipulation.
Use Acrobat Pro Action Wizard and JavaScript
Create a custom action in Acrobat Pro to run a JavaScript snippet that automatically calculates the first page's dimensions and inserts a matching blank page at the start.
By utilizing the Action Wizard, you can apply this JavaScript code across multiple PDF files simultaneously, saving time on manual page formatting.
Launch Adobe Acrobat Pro, navigate to the 'Tools' tab, and click on 'Action Wizard' under the Customize section.
Click 'New Action' in the top toolbar to begin building your batch process.
In the left panel under 'Choose tools to add', expand 'More Tools', select 'Execute JavaScript', and click the plus icon to add it to your action steps on the right.
Uncheck 'Prompt user', then click 'Specify Settings'. Paste the following script into the window: var pageBox = this.getPageBox('Crop', 0); var pageWidth = pageBox[2] - pageBox[0]; var pageHeight = pageBox[1] - pageBox[3]; this.newPage(-1, pageWidth, pageHeight);
Click 'OK', save the Action with a memorable name, and then run it on your target PDF files or selected folders.

Insert Blank Pages Easily with WPS Office
If you don't want to deal with custom JavaScript coding, WPS Office provides a highly intuitive PDF editor that lets you visually insert blank pages, manage layouts, and merge documents in just a few clicks.
- 1. Open the PDF: Launch WPS Office and open your target PDF document.
- 2. Navigate to the Page Tab: Click on the 'Page' tab located in the top ribbon menu to access page management tools.
- 3. Insert a Blank Page: Click the 'Insert Page' button and choose 'Blank Page' from the dropdown menu.
- 4. Set Position and Confirm: Select 'First Page' or specify your desired location, adjust the dimensions if needed, and click 'OK' to instantly add the blank page.

Frequently Asked Questions
Does this JavaScript work in the free Adobe Acrobat Reader?
No, executing custom document-level JavaScript and utilizing the Action Wizard for batch processing are premium features restricted to Adobe Acrobat Pro.
How do I ensure the blank page is inserted at the end instead of the beginning?
To insert a page at the end of the PDF using JavaScript, change the first parameter in the this.newPage() method from -1 to this.numPages - 1.
Can I insert a pre-designed cover page from another PDF instead of a blank page?
Yes, instead of this.newPage(), you can use the this.insertPages() method in your Acrobat JavaScript to extract and insert a specific page from an external PDF file path.
Why are the page dimensions sometimes incorrect when using the getPageBox script?
If the original document uses different box definitions (such as MediaBox vs. CropBox), the captured dimensions might vary. Make sure you specify 'Crop' or 'Media' accurately in the this.getPageBox() function based on your specific document's properties.




