PDF Printing Issues

How to Use Acrobat JavaScript to Print 4 Pages Per Sheet Without Save Prompts

Steve KSteve K Nov 5, 2026 869 views

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.

How to Use Acrobat JavaScript to Print 4 Pages Per Sheet Without Save Prompts
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.
Before you start

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.

Solution 1Recommended

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.

1
Open your script editor

Open the Adobe Acrobat JavaScript console or navigate to the folder-level application script where your printing automation is located.

2
Locate the end of the execution block

Scroll to the end of your script, ensuring you are placing the code immediately after the printing and formatting commands have been executed.

3
Insert the dirty flag reset command

Type 'this.dirty = false;' to reset the document's modification flag back to an unmodified state.

4
Save and test

Save your script and test it on sample PDFs to ensure it prints the 4-up layout successfully without triggering the save dialog.

Use the 'dirty' Property to Prevent Save Prompts
Testing Scripts: Always test your folder-level JavaScripts carefully on sample PDFs before deploying them to a production environment to ensure no unexpected document data is lost.
Print PDFs Easily Without Coding

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. 1. Open the PDF document: Launch WPS Office and open the PDF file you wish to print.
  2. 2. Access the Print menu: Press Ctrl + P on your keyboard or go to the main Menu and select 'Print'.
  3. 3. Configure multiple pages: Under the 'Page Handling' section in the print dialog, select 'Multiple pages per sheet'.
  4. 4. Set to 4-up printing: Set the 'Pages per sheet' option to 4 and adjust your layout and border preferences.
  5. 5. Print the document: Click 'Print' to generate your document instantly without dealing with scripts or save prompts.
Easily print 2, 4, or more pages per sheet from the standard print menuHighly compatible with all standard PDF files and Adobe formatsLightweight application that runs smoothly on most operating systemsNo coding or scripting required for advanced print layouts
microsoft office alternative - wps office

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.