• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to hide highlighted area of editable field in PDF?

Explorer ,
May 26, 2020 May 26, 2020

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?

 

PDF issue.png

TOPICS
Edit and convert PDFs , PDF forms

Views

4.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 26, 2020 May 26, 2020

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;

 

Votes

Translate

Translate
Community Expert ,
May 26, 2020 May 26, 2020

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;

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 07, 2020 Jun 07, 2020

Copy link to clipboard

Copied

Do you know if the script above is added in Indesign or in Acrobat?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 07, 2020 Jun 07, 2020

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. 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 07, 2020 Jun 07, 2020

Copy link to clipboard

Copied

Would you know how to insert a document script? I can google it if you don't.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 07, 2020 Jun 07, 2020

Copy link to clipboard

Copied

In Acrobat Pro, Select the JavaScripts toolbar, or use the tool search to search for "Document JavaScripts". 

 

DocScripts.jpg

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 07, 2020 Jun 07, 2020

Copy link to clipboard

Copied

Thank you so much! I really appreciate it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 08, 2020 Jun 08, 2020

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 09, 2020 Jun 09, 2020

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?

Screen Shot 2020-06-10 at 12.44.25 PM.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 10, 2020 Jun 10, 2020

Copy link to clipboard

Copied

Replace that code with it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 10, 2020 Jun 10, 2020

Copy link to clipboard

Copied

Awesome! That works perfect! Thank you so much.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 29, 2022 Apr 29, 2022

Copy link to clipboard

Copied

LATEST

Hello- Is it possible to have most of the fields highlighted but one of the fields hidden yet still fillable? Thank you!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 17, 2020 Aug 17, 2020

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 17, 2020 Aug 17, 2020

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. 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 18, 2020 Aug 18, 2020

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 18, 2020 Aug 18, 2020

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 18, 2020 Aug 18, 2020

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

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 19, 2020 Aug 19, 2020

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2020 Aug 19, 2020

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/

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines