How to Use Acrobat JavaScript to Print 4 Pages Per Sheet Without Save Prompts
Question details
The user needs to write an Acrobat JavaScript to print four PDF pages per sheet (4-up) with filenames and page numbers, while preventing the application from prompting to save changes to the original document.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Automating PDF printing tasks using JavaScript to print multiple pages per sheet without interruptive save prompts.
- Observed behavior
- After running a script to format and print a PDF, Acrobat triggers an unwanted prompt asking the user to save changes to the document.
Ensure you are using Adobe Acrobat Pro or Standard, as advanced JavaScript execution for batch printing and document modifications is restricted in the free Acrobat Reader.
Use the 'dirty' Property to Prevent Save Prompts
Add a specific JavaScript command at the end of your script to tell Acrobat that the document has not been modified.
When running custom scripts to manipulate PDF layouts or add watermarks before printing, Acrobat flags the document as modified. By manually resetting this flag, you can close the file or end the process without triggering a save dialog.
Open the Adobe Acrobat JavaScript console or navigate to the folder-level application script where your printing automation is located.
Scroll to the end of your script, ensuring you are placing the code immediately after the printing and formatting commands have been executed.
Type 'this.dirty = false;' to reset the document's modification flag back to an unmodified state.
Save your script and test it on sample PDFs to ensure it prints the 4-up layout successfully without triggering the save dialog.

Print Multiple Pages Per Sheet Easily with WPS Office
Skip the complex JavaScript coding. WPS PDF provides a built-in, user-friendly interface to print multiple pages (like 4-up) on a single sheet, completely free.
- 1. Open the PDF document: Launch WPS Office and open the PDF file you wish to print.
- 2. Access the Print menu: Press Ctrl + P on your keyboard or go to the main Menu and select 'Print'.
- 3. Configure multiple pages: Under the 'Page Handling' section in the print dialog, select 'Multiple pages per sheet'.
- 4. Set to 4-up printing: Set the 'Pages per sheet' option to 4 and adjust your layout and border preferences.
- 5. Print the document: Click 'Print' to generate your document instantly without dealing with scripts or save prompts.

Frequently Asked Questions
Can I run this JavaScript in Adobe Acrobat Reader?
Folder-level JavaScripts and advanced document modification scripts generally require Acrobat Pro or Standard. Acrobat Reader restricts many JavaScript capabilities for security reasons.
How do I add filenames and page numbers when printing multiple pages?
In Acrobat, you can use the 'Add Header & Footer' tool before printing, or handle it within your JavaScript using the addWatermarkFromText method to dynamically place the filename and page number on each page.
What does this.dirty = false actually do?
It resets the internal flag that Acrobat uses to track unsaved changes. By setting it to false, Acrobat believes the document is unmodified and will allow you to close it without showing a save prompt.




