PDF Editing Issues

How to Jump to Specific PDF Form Pages Using JavaScript or Destinations

Algirdas JasaitisAlgirdas Jasaitis Oct 28, 2026 869 views

Question details

The user wants to configure form buttons in a PDF document to automatically navigate to specific pages, such as jumping from page one to page four.

How to Jump to Specific PDF Form Pages Using JavaScript or Destinations
Product
PDF Editor
Device & OS
not provided
Scenario
Building interactive PDF forms and setting up navigation buttons to jump between non-sequential pages.
Observed behavior
Requires a method to trigger a page jump action when a user clicks a form button, either through scripting or built-in destination tools.
Before you start

Ensure your PDF editor supports form editing and action triggers. If you plan to use JavaScript, take note of the exact target page numbers.

Solution 1Recommended

Configure a Mouse Up JavaScript Action

Use a simple JavaScript command attached to a form button to jump to a specific page index.

PDF JavaScript uses zero-based page indexing. This means the first page is 0, the second page is 1, and so on. To jump to the fourth page, you will use index 3.

1
Select the Button Properties

Right-click the form button you want to use for navigation and select 'Properties'.

2
Add an Action

Go to the 'Actions' tab, choose 'Mouse Up' as the trigger, and select 'Run a JavaScript' from the Action drop-down menu.

3
Enter the Script

Click 'Add' and enter the code: `this.pageNum = 3;` (replace '3' with your target page index). Click 'OK' to save.

Configure a Mouse Up JavaScript Action
Zero-Based Indexing: Always subtract 1 from your target page number to get the correct JavaScript index.
WPS PDF Editor

Create Interactive PDFs with WPS Office

WPS Office provides an intuitive PDF editor that lets you easily add hyperlinks, bookmarks, and page navigation tools without writing complex JavaScript.

  1. 1. Open Your PDF: Launch WPS Office and open your PDF document.
  2. 2. Insert a Link: Navigate to the 'Edit' tab and click on 'Link' to draw a clickable area on your document.
  3. 3. Set Link Action: In the pop-up properties window, select the option to jump to a specific page and enter your desired target page number.
  4. 4. Save Document: Click 'OK' and save your PDF. The clickable area will now navigate directly to the specified page.
Add internal links to jump seamlessly between specific PDF pagesFully compatible with standard PDF formats and interactive elementsLightweight, fast, and simple to use for everyday PDF tasks
QA img-9

Frequently Asked Questions

Why does my JavaScript jump command go to the wrong page?

PDF JavaScript uses zero-based indexing. If you want to jump to page 4, you must use `this.pageNum = 3;`. Using `4` will incorrectly take you to page 5.

Do named destinations break if I add pages to my PDF?

No, one of the main advantages of using named destinations is that they remain intact and point to the correct location even if pages are added or deleted before the destination.

Can I navigate to a different PDF document entirely using form buttons?

Yes, in the button properties under the Actions tab, you can select 'Open a file' or 'Go to a page view in another document' to navigate to external PDFs.