How to Add a PDF Print Button for Specific Pages in Adobe Acrobat
Question details
The user wants to create an interactive button within a PDF that automatically prints a predefined specific page range when clicked.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF document with custom print actions, such as printing pages associated with a specific section or bookmark.
- Observed behavior
- Native menu actions in Acrobat do not support setting custom page ranges for print buttons, requiring a custom JavaScript solution.
Ensure you have Adobe Acrobat Pro or a PDF editor that supports form creation and JavaScript actions, as standard read-only PDF viewers cannot configure custom interactive scripts.
Configure a Print Button Using Acrobat JavaScript
Assign a custom JavaScript action to a form button to define the exact print parameters, including the start and end pages.
Adobe Acrobat requires custom JavaScript to define specific page ranges for print buttons. The script utilizes the getPrintParams() method to set the firstPage and lastPage properties.
It is crucial to understand that Acrobat JavaScript uses zero-based numbering. This means page 1 is represented as 0, page 2 as 1, page 5 as 4, and so on.
Open your PDF in Adobe Acrobat, navigate to the 'Prepare Form' tool, and add a Button field to your desired location on the document page.
Right-click the newly created button, select 'Properties' from the context menu, and navigate to the 'Actions' tab.
Choose 'Mouse Up' as the trigger event, select 'Run a JavaScript' from the 'Select Action' dropdown menu, and click the 'Add' button.
In the JavaScript Editor, input the print parameters. For example, to print pages 2 through 5, enter: var pp = this.getPrintParams(); pp.firstPage = 1; pp.lastPage = 4; this.print(pp);
Click 'OK' to close the editor, exit form editing mode, and click your button to verify that the print dialog prompts only the specified page range.

Easily Print Specific PDF Pages with WPS Office
While creating interactive JavaScript buttons requires advanced PDF coding, WPS Office provides an incredibly intuitive Print interface to quickly select and print specific pages or bookmarks without writing any scripts.
- 1. Open your PDF in WPS Office: Launch WPS Office and open your PDF document using the built-in PDF viewer.
- 2. Open the Print Dialog: Click on the 'Print' icon in the top toolbar or press Ctrl + P (Windows) / Cmd + P (Mac) to open the print settings.
- 3. Specify the Page Range: In the 'Pages to Print' section, select 'Pages' and enter your desired custom range (e.g., 2-5) into the text box.
- 4. Print the Document: Adjust any other necessary settings like multiple pages per sheet, then click 'Print' to output your specific pages instantly.

Frequently Asked Questions
Why does my Acrobat JavaScript print button print the wrong pages?
Acrobat JavaScript uses zero-based page numbering. If you want to print page 3, you must use the number 2 in your script. Always subtract one from the actual page number you want to target.
Can I use this script to print non-consecutive pages?
The standard getPrintParams() method with firstPage and lastPage properties only prints a continuous range. For non-consecutive pages, you would need to loop through the print command multiple times or configure advanced array-based JavaScript functions.
Will the interactive print button work in all PDF viewers?
Interactive JavaScript print buttons rely on the viewer's JavaScript engine. While they work perfectly in Adobe Acrobat and some advanced editors, basic third-party or browser-based PDF readers may not execute custom print scripts.
How do I hide the print button so it doesn't appear on the printed paper?
In Adobe Acrobat, open the Button Properties, go to the 'General' tab, and change the 'Form Field' property dropdown to 'Visible but doesn't print'. This ensures the button remains clickable on screen but is excluded from the physical output.




