PDF Printing Issues

How to Set Double-Sided Printing via PDF Button Using JavaScript

Khadija KhanKhadija Khan Oct 28, 2026 869 views

Question details

The user wants to configure an interactive PDF form button to automatically trigger a double-sided (duplex) print job using JavaScript.

How to Set Double-Sided Printing Using a PDF Form Button
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating an interactive PDF form where users can click a specific button to print the document on both sides of the paper without manually adjusting the generic print dialog.
Observed behavior
The standard print command opens the default print dialog without forcing duplex printing. Custom JavaScript is required to define and pass the exact print parameters.
Before you start

Ensure that the destination printer hardware actually supports automatic double-sided (duplex) printing, as JavaScript commands cannot override physical printer limitations.

Solution 1Recommended

Configure JavaScript for Duplex Printing in a PDF Button

Program your PDF form button with a specific JavaScript snippet to bypass standard print defaults and automatically request double-sided printing.

Interactive PDF form buttons can be customized using JavaScript to define specific print parameters. By binding a script to the button's 'Mouse Up' action, you can instruct Acrobat to send a duplex printing request directly to the printer.

1
Access Button Properties

Enter form editing mode in your PDF editor. Right-click the button you want to configure for printing and select 'Properties' from the context menu.

2
Add a JavaScript Action

Navigate to the 'Actions' tab. Under the 'Select Trigger' dropdown, choose 'Mouse Up'. Under the 'Select Action' dropdown, choose 'Run a JavaScript', and click the 'Add' button.

3
Input the Print Parameters Code

In the JavaScript Editor window that appears, paste the following code to request short-edge duplex printing: var pp = this.getPrintParams(); pp.DuplexType = pp.constants.duplexTypes.DuplexFlipShortEdge; this.print(pp);

4
Adjust the Flip Edge (Optional)

If your document layout is portrait and requires standard book-style binding, change 'DuplexFlipShortEdge' to 'DuplexFlipLongEdge' in the script before clicking 'OK' to save.

Configure JavaScript for Duplex Printing in a PDF Button
Printer Capabilities: This script politely requests the printer to output double-sided. If the end-user's printer does not support duplex printing or if the feature is disabled in their system settings, the document will default to printing single-sided.
Easy PDF Printing

Print Double-Sided PDFs Effortlessly with WPS Office

Skip the complex JavaScript coding when you just need to print standard documents. WPS PDF provides an intuitive, built-in interface for managing advanced print settings, allowing you to easily toggle double-sided printing on both short and long edges.

  1. 1. Open Your PDF: Launch WPS Office and open your target PDF document.
  2. 2. Access the Print Dialog: Click on the 'Menu' button in the top left corner and select 'Print', or simply press Ctrl + P on your keyboard.
  3. 3. Select Duplex Options: In the print dialog box, check the 'Print on both sides of paper' option. Choose either 'Flip on long edge' or 'Flip on short edge' depending on your layout, and click 'Print'.
One-click toggle for double-sided printing without the need for scripting.Fully compatible with standard PDF formats, annotations, and interactive forms.Lightweight PDF reader and editor with robust form-filling capabilities.
microsoft office alternative - wps office

Frequently Asked Questions

Why isn't my PDF button printing double-sided even with the correct JavaScript code?

The JavaScript code only sends a parameter request to the printer. If the selected printer lacks physical duplex capabilities or if duplex printing is restricted in the operating system's printer driver settings, the command will be ignored and it will print single-sided.

What is the difference between short-edge and long-edge flipping?

Long-edge flipping binds the pages along the longer side of the paper (like a standard portrait book). Short-edge flipping binds them along the shorter side, which is typically used for landscape documents like presentation slides or calendars.

Will this JavaScript print button work in all PDF readers?

No, the 'this.getPrintParams()' JavaScript API is primarily supported by Adobe Acrobat and Adobe Reader. Many third-party PDF viewers, mobile apps, or browser-based PDF readers may not execute this specific script or pass the duplex parameter correctly.