How to Batch Remove PDF Link Highlighting Using JavaScript
Question details
The user needs an automated method to eliminate the inverted highlight effect from all internal links within a large PDF simultaneously.

- Product
- Adobe Acrobat / PDF
- Device & OS
- not provided
- Scenario
- Working with a large PDF document containing numerous internal links that currently display an inverted highlight upon selection.
- Observed behavior
- Links exhibit an inverted highlight effect when clicked, and manually changing the highlight mode for each individual link is highly inefficient.
Always save a backup copy of your PDF document before running any document scripts to prevent accidental data loss or irreversible formatting changes.
Use the Acrobat JavaScript Console for Batch Removal
Execute a short JavaScript snippet to loop through all pages and set the highlight mode of every link annotation to 'None'.
This method utilizes the built-in JavaScript console in your PDF editor to automate the process of modifying link properties, completely bypassing the need to right-click and edit each link's appearance individually.
Launch Adobe Acrobat, open your PDF file, and press Ctrl + J (Windows) or Cmd + J (Mac) to open the Acrobat JavaScript Debugger Console.
Clear any existing text in the console window and paste the following script: for (var p = 0; p < this.numPages; p++) { var box = this.getPageBox('Crop', p); var links = this.getLinks(p, box); if (!links || !links.length) continue; for (var i in links) { links[i].highlightMode = 'None'; } }
Highlight all the pasted code with your mouse, then press Ctrl + Enter (Windows) or Cmd + Enter (Mac) using your numeric keypad to execute the script.
Go to File > Save or press Ctrl + S to save the document and permanently apply the new link highlight settings.

Manage and Edit PDF Links Easily with WPS Office
WPS Office provides a highly intuitive PDF editor that lets you quickly add, edit, or customize links in your documents without needing to work with complex JavaScript code.
- 1. Open your PDF: Launch WPS Office and open your PDF document containing the links you want to modify.
- 2. Access the Edit Tab: Navigate to the 'Edit' tab located on the top ribbon menu to reveal the PDF editing tools.
- 3. Select the Link Tool: Click on the 'Link' button. This will highlight all currently active and clickable areas within your document.
- 4. Modify Link Properties: Right-click the specific link you wish to modify, select 'Properties', and adjust the appearance settings such as highlight style or border thickness.

Frequently Asked Questions
Why do PDF links display an inverted highlight when clicked?
By default, many PDF viewers use an inverted, outlined, or inset highlight mode to provide immediate visual feedback to users, confirming that a hyperlink or button has been successfully clicked.
Will running this JavaScript affect my text highlighter annotations?
No. The script specifically targets the 'highlightMode' property of interactive link annotations retrieved via 'getLinks()'. It does not interact with or alter text markup tools like standard highlighting, underlining, or strikethroughs.
How do I open the JavaScript console if the keyboard shortcut doesn't work?
If the shortcut fails, you can manually open the console by navigating to Tools > JavaScript > Document JavaScripts in the top menu, or by searching for 'JavaScript Debugger' in your application's tool search bar.




