How to Add a Button to Print Only the Current PDF Page
Question details
The user wants to configure an interactive button within a PDF document so that clicking it automatically triggers the printing of only the specific page where the button is located, rather than the entire document.

- Product
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form or document where users need a quick, one-click shortcut to print a specific individual page without manually adjusting the print settings.
- Observed behavior
- A custom action needs to be applied to the button's properties to bypass the default whole-document printing behavior and isolate the current page.
Ensure you are using a PDF editor that supports form fields and JavaScript execution, and verify that you have full editing permissions for the document.
Use JavaScript on the Button's Mouse Up Action
Configure the button to run a specific JavaScript command when clicked, which identifies the page index of the button and sends only that page to the printer.
PDF form buttons can be assigned custom actions using JavaScript. By attaching a specific print command to the 'Mouse Up' trigger, the PDF viewer will execute the print job specifically for the page housing the button.
Open your document in your PDF editor, navigate to the Form or Interactive Forms tab, and insert a new Push Button onto the desired page.
Right-click the newly created button, select 'Properties' from the context menu, and switch to the 'Actions' tab.
In the 'Select Trigger' dropdown, choose 'Mouse Up'. In the 'Select Action' dropdown, choose 'Run a JavaScript', then click 'Add'.
In the JavaScript editor window, type exactly: this.print(true, event.target.page); and click OK to save the script. Close the properties dialog.

Create and Manage Interactive PDFs with WPS Office
WPS Office features a powerful PDF editor that allows you to easily design interactive forms, add functional buttons, and manage advanced printing settings without hassle.
- 1. Open Your Document: Launch WPS Office and open your existing PDF file using the PDF editor.
- 2. Navigate to Form Tools: Go to the 'Form' tab on the top ribbon to access interactive form controls.
- 3. Add a Push Button: Select the 'Push Button' tool, draw it on your page, and double-click it to configure its print actions.

Frequently Asked Questions
Can I hide the print button so it doesn't appear on the printed paper?
Yes. In the button's Properties dialog, go to the General or Appearance tab and look for the 'Form Field' visibility setting. Change it from 'Visible' to 'Visible but doesn't print'. This ensures the button remains clickable on screen but is invisible on the physical copy.
Will this JavaScript print button work on mobile devices?
The functionality depends on the PDF viewer app. While desktop applications like WPS Office and Adobe Acrobat fully support PDF JavaScript, many mobile PDF readers restrict or disable JavaScript execution for security and performance reasons. The button may not trigger a print job on smartphones or tablets.
How do I print a specific range of pages instead of just one?
If you need to print a range of pages, you can either modify the JavaScript to include specific page indexes or simply use the standard print shortcut (Ctrl + P) and manually enter the page numbers in the 'Pages to Print' section of the print dialog.




