How to Fix Acrobat Reader Not Applying JavaScript Field Color Changes
Question details
The user's PDF JavaScript successfully changes a text field's value and visibility in Acrobat Pro, but fails to change the fill color to red when opened in Acrobat Reader.

- Product
- Adobe Acrobat Reader
- Device & OS
- not provided
- Scenario
- Using JavaScript in a PDF form to dynamically change a text field's fill color.
- Observed behavior
- The text field fill color does not update to the specified color in Acrobat Reader, likely due to application-wide field highlighting overriding the custom script.
Ensure you have the necessary permissions to edit document-level JavaScript and inform users if your script will change application-wide settings like field highlighting.
Disable Field Highlighting via Document-Level JavaScript
Use a Document-Level script to disable field highlighting automatically when the user opens the PDF, allowing your custom field colors to display properly.
When Adobe Acrobat Reader's default field highlighting is enabled, it applies a colored overlay that masks any custom background colors set via JavaScript. By turning this feature off programmatically, your custom red fill color will become visible.
Open your PDF in Acrobat Professional. Navigate to 'Tools', choose 'JavaScript', and then select 'Document JavaScripts'.
Create a new script and add the code app.runtimeHighlight = false; to turn off the global highlight setting.
Ensure your initialization script is configured to execute automatically when the document is opened so the highlight setting changes immediately.

Manually Disable Field Highlighting in Reader Settings
If you prefer not to use a global script that modifies application settings, you can instruct users to manually turn off field highlighting.
Manage PDF Forms Easily with WPS Office
If managing complex PDF JavaScripts and reader compatibility issues becomes tedious, try WPS Office. It provides a lightweight, highly compatible alternative for handling PDFs, filling forms, and managing your office documents without the hassle of conflicting application settings.

Frequently Asked Questions
Why does my JavaScript field color change show in Acrobat Pro but not Reader?
Acrobat Reader uses a default 'field highlighting' feature that overlays a color tint on form fields. This overlay hides the custom background colors you set via JavaScript. Disabling the highlighting reveals your custom colors.
How can I execute a JavaScript automatically when a PDF opens?
You can create a Document-Level script in your PDF authoring tool and place your code (such as app.runtimeHighlight = false;) inside an initialization function that is triggered by the OpenDocument event.
Does changing the runtimeHighlight property affect other PDFs?
Yes, changing app.runtimeHighlight alters the application-wide setting for Adobe Acrobat Reader. Until it is turned back on or the application is restarted, other PDFs opened in the same session will also have field highlighting disabled.




