Copy link to clipboard
Copied
I have created a PDF and inserted editable fields, but when I save and send it to the client the highlighted box is still shown (as seen below). Can I just show the text (Date & Time etc) in the editable field without having the faded gray highlighted field?
Acrobat automatically highlights field so the user knows where they are. You can turn this off in your fields by adding this code to a document script.
app.runtimeHighlight = false;
Copy link to clipboard
Copied
Acrobat automatically highlights field so the user knows where they are. You can turn this off in your fields by adding this code to a document script.
app.runtimeHighlight = false;
Copy link to clipboard
Copied
Do you know if the script above is added in Indesign or in Acrobat?
Copy link to clipboard
Copied
Not that I know of. The code has to be added in Acrobat.
The field highlight is a function of the user's setup. Field Highlights are turned on by default. The user can turn them off from thier preference settings, or you can put the code I posted into a document script.
Copy link to clipboard
Copied
Would you know how to insert a document script? I can google it if you don't.
Copy link to clipboard
Copied
In Acrobat Pro, Select the JavaScripts toolbar, or use the tool search to search for "Document JavaScripts".
Copy link to clipboard
Copied
Thank you so much! I really appreciate it.
Copy link to clipboard
Copied
Be aware that that code changes the setting not just for your file, but for all files opened on that machine.
Copy link to clipboard
Copied
Hi, do you know where to insert the script you gave me, app.runtimeHighlight = false; into the Acrobat Javascripts window?
Copy link to clipboard
Copied
Replace that code with it.
Copy link to clipboard
Copied
Awesome! That works perfect! Thank you so much.
Copy link to clipboard
Copied
Hello- Is it possible to have most of the fields highlighted but one of the fields hidden yet still fillable? Thank you!
Copy link to clipboard
Copied
This is great! But I found it doesn't work if the pdf is opened up in Microsoft Teams, or in a browser. Any ideas in these use cases?
Copy link to clipboard
Copied
The solutions presented hear are implemented in Acrobat JavaScript. While the script is a simple one liner, the minimum bar for this techniqe to operate in any PDF viewer, is that the viewer runs JavaScript, and that the scripting it will run includes the particlar objects and properties used in the script. Sadly, only a few good viewers actually implement the Acrobat Model, and only a few of these implement the complete model.
The only solution for making a document equally usable in all viewers is to not include interactive features,i.e., scripts and form fields. Obviously, this isn't a tenable solution, and while it sounds bleak, there is another solution. Force the user to open the PDF in a compliant viewer. Cover the page content with something, it could an annotation, form field, or OCG layer. This cover should tell the user to open the PDF in a decent viewer, like the free Adobe Reader. Then place code in a document script to hide the cover. If the cover is hidden when opened, then it's likely the viewer will run enough script to make the form usable. If the cover remains visible, then the form won't work on the vierwer and all the user sees is the message telling them how to open the PDF.
Copy link to clipboard
Copied
I figured I might get frustrated by the inconsistency of viewer implementation details.
But, thanks for the suggestion to use a cover element - brilliant! I'll try to figure that one out - maybe there's a way to hide a layer?
Interestingly - and I'm using Microsoft Edge as an example - the javascript to turn off form field highlighting isn't being executed, but a calculation field that uses javascript to perform subtraction still works. So, now I'm curious, since in this case, it's not simply that Edge doesn't support javascript in the document.
But, in support of your cover suggestion, Safari doesn't support any of the calculation fields - not standard summing fields, nor javascript subtraction. But it does turn off highlighting, and toggles it on for each field the cursor passes over, which is actually nice.
Copy link to clipboard
Copied
The support for JS is many times not a true/false situation. Many applications support some JS commands and not others. The issue is that's not well documented, and it varies from application to application (and even from version to version of the same application), which makes it very difficult to rely on it working outside of the Adobe apps.
Copy link to clipboard
Copied
An OCG is an excellent choice because it requires a high level of Acrobat model compliance. OCGs can also be attached to form fields (not in the Acrobat UI). So both page content and fields/annotations can be hidden/shown at the same time with a single line of JS code.
Here's a sample file that demonstrates and explains the techniques. However, it is not free. Available to members only. But members can also download a plug-in for attaching OCGs to annotations and setting OCG properties that are not available in the Acrobat UI.
https://www.pdfscripting.com/public/Lite-Document-Security-Description.cfm
Copy link to clipboard
Copied
Thanks for the advice, Thom. I'm laying out in InDesign and using layers - is that the same thing as an OCG? I found even a cover page layer doesn't render consistently across viewers - maddening!
I will definitely take a look at the pdfscripting.com site - having trouble using javascript to format a field for: phone number, zip-code, dollar value, etc., but I guess that's another topic entirely!
Copy link to clipboard
Copied
I'm not sure of the details in InDesign, but yes, it's possible for Layers in Indesign to become OCG Layers in the PDF. You'll see them on the Layer's panel in Acrobat.
This article explains OCG layers in Acrobat.
https://acrobatusers.com/tutorials/create_use_layers/