Skip to main content
Participant
March 20, 2025
Question

How can I create a hover effect for a hyperlink in a pdf?

  • March 20, 2025
  • 3 replies
  • 841 views

I have tried by going into a pdf and creating a link and customizing it but on most browsers it does not highlight. Is there a script I can add to make it highlight when I hover over those links? 

3 replies

JR Boulay
Community Expert
Community Expert
April 7, 2025

You don't need any script.

Remove the link object and replace it by a button form field using the 3 states.

You can use label only, icon only or icon + label.

 

Acrobate du PDF, InDesigner et Photoshopographe
AnandSri
Legend
April 7, 2025

Hello!

 

I hope you are doing well.

 

As correctly shared by our community product expert, the plug-ins available for browsers, have their mechanism to render PDFs, and many features may or may not work.

You may try the below suggestions, and may have to customize as per your requirements and environment: 

 

Use JavaScript for Hover Effects:

Open the PDF in Acrobat and go to Tools > JavaScript > Document JavaScripts.
Create a new script and add the following code to show a hover effect:


var linkField = this.getField("linkFieldName");
linkField.setAction("MouseEnter", "this.getField('hoverFieldName').display = display.visible;");
linkField.setAction("MouseExit", "this.getField('hoverFieldName').display = display.hidden;");

 

Replace "linkFieldName" with the name of your link field and "hoverFieldName" with the name of the field that will display the hover effect

 

 

Create Hidden Fields:

  • Create a text field that will display the hover effect. Set its initial visibility to hidden.
  • Go to Tools > Prepare Form, add a text field, and name it "hoverFieldName". Set its visibility to hidden.

For more information, please see this article: Acrobat JavaScript API Reference — Acrobat-PDFL SDK: JavaScript Reference

 

I hope this helps.

Thanks,

Anand Sri.

Bernd Alheit
Community Expert
Community Expert
April 7, 2025

This will not work in Acrobat Reader.

try67
Community Expert
Community Expert
March 20, 2025

There is, but it's likely it won't work correctly in a browser, as most browser PDF plugins have very poor support for scripts, so it's not really worth the trouble.