Set Different Default Highlight Colors For Fields?

Explorer ,
Aug 14, 2017

Copy link to clipboard

Copied

Is it possible to set different default field highlight colors? Adobe Pro X

For example; the below code I found sets all document highlights to red

if (!app.viewerVersion < 6) { // for version 6 or above

app.runtimeHighlight = true; // turnon field highlighting

app.runtimeHighlightColor = color.red; // set field color

}

Is it possible to set a default field highlight of "textField1" with a color.blue and "textField2" to color.red?

I tried the script below for giggles: (of course, it did not work)

var test1 = this.getField("textField1");
var test2 = this.getField("textField2");

test1.runtimeHighlightColor = color.blue;

test2.runtimeHighlightColor = color.red;

I couldn't find anything in the API reference either.

Adobe Community Professional
Correct answer by Joel_Geraci | Adobe Community Professional

The solution to what you describe requires a lot of scripting.

And you actually do want the fillColor; you just have to be clever with it. You'd use JavaScript to turn off the application level highlighting for your document only. Then you'd use the fillColor to "highlight" the different sets of fields with the colors you want and use document events like "WillPrint" and "DidPrint" etc.  to set the fillColor to transparent before printing then back to what you want after printing.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

981

Likes

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

Set Different Default Highlight Colors For Fields?

Explorer ,
Aug 14, 2017

Copy link to clipboard

Copied

Is it possible to set different default field highlight colors? Adobe Pro X

For example; the below code I found sets all document highlights to red

if (!app.viewerVersion < 6) { // for version 6 or above

app.runtimeHighlight = true; // turnon field highlighting

app.runtimeHighlightColor = color.red; // set field color

}

Is it possible to set a default field highlight of "textField1" with a color.blue and "textField2" to color.red?

I tried the script below for giggles: (of course, it did not work)

var test1 = this.getField("textField1");
var test2 = this.getField("textField2");

test1.runtimeHighlightColor = color.blue;

test2.runtimeHighlightColor = color.red;

I couldn't find anything in the API reference either.

Adobe Community Professional
Correct answer by Joel_Geraci | Adobe Community Professional

The solution to what you describe requires a lot of scripting.

And you actually do want the fillColor; you just have to be clever with it. You'd use JavaScript to turn off the application level highlighting for your document only. Then you'd use the fillColor to "highlight" the different sets of fields with the colors you want and use document events like "WillPrint" and "DidPrint" etc.  to set the fillColor to transparent before printing then back to what you want after printing.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

982

Likes

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
Aug 14, 2017 0
Adobe Community Professional ,
Aug 14, 2017

Copy link to clipboard

Copied

The app object properties runtimeHighlight and runtimeHighlightColor are application level properties... notice the bold. What you're looking for is the field fillColor property that you'd change based on some field condition or event.

Likes

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
Reply
Loading...
Aug 14, 2017 0
Explorer ,
Aug 14, 2017

Copy link to clipboard

Copied

No, the field fillColor is not what I'm looking for ... I'm using Acrobat X Pro and when a form is first opened, and it contains active fields, the active fields have a default "bluish" highlight (That is, if the "Highlight Existing Fields" button is selected, or a JavaScript with "app.runtimeHighlight = true;" has been run). These highlights are not printed either (which is what I want)

The highlights only purpose is to show the user that the fields are there... the "app." level property will change this default setting to any other color, but as far as I can tell it is global (as in all field highlights are changed at once) and the fields cannot be separated using this method. (maybe I'm wrong?)

The fillColor does not affect these "bluish" highlights; in fact, if one adds a fillColor to a field, the "bluish" highlight covers the fill color until the user clicks into the field.... so my question goes back to the original, and maybe someone else could provide the answer to this...... ?

Is there a property that can be used to set more than one default field highlight color (not fillColor)?
Example: Half of the form field highlight is red and the other half is blue?

I was hoping for a much simpler solution not requiring a lot of scripting.

Likes

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
Reply
Loading...
Aug 14, 2017 0
Most Valuable Participant ,
Aug 15, 2017

Copy link to clipboard

Copied

Is there a property that can be used to set more than one default field highlight color (not fillColor)?

No.

Likes

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
Reply
Loading...
Aug 15, 2017 1
Adobe Community Professional ,
Aug 15, 2017

Copy link to clipboard

Copied

The solution to what you describe requires a lot of scripting.

And you actually do want the fillColor; you just have to be clever with it. You'd use JavaScript to turn off the application level highlighting for your document only. Then you'd use the fillColor to "highlight" the different sets of fields with the colors you want and use document events like "WillPrint" and "DidPrint" etc.  to set the fillColor to transparent before printing then back to what you want after printing.

Likes

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
Reply
Loading...
Aug 15, 2017 0
Explorer ,
Aug 15, 2017

Copy link to clipboard

Copied

Hi Joel, sorry if I sounded abrupt as I really do appreciate your input. I was hoping not to have to do it that way because as you stated it "requires a lot of scripting."

I have Word documents converted to .pdf that have several tables with different background colors to signify different processes, and after adding in all the active fields to the table cells the original background color is basically hidden from view by all the active fields highlight color.

I was hoping for a simpler way for the table background colors to be more visible to the user, such as, closely matching the active field default highlight color to the table background color, but not matching it too close so that the field disappears completely.

This may be more work than it's worth....

Likes

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
Reply
Loading...
Aug 15, 2017 0
Adobe Community Professional ,
Aug 15, 2017

Copy link to clipboard

Copied

There are ways you can get clever with field names that will mitigate the amount of scripting required but there's going to be scripting. I'm not sure how much Acrobat scripting experience you have but if you need to gauge the level of difficulty, I could hammer this out over two martinis... but I've also been doing this for 20 years.

Likes

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
Reply
Loading...
Aug 15, 2017 0
Explorer ,
Aug 15, 2017

Copy link to clipboard

Copied

Thanks, Joel. I usually farm out the "heavy lifting" scripts, but right now we have no budget for it. I know enough scripting to be dangerous and could handle it at this level, but my current additional duties call and I don't have the extra time needed to put this part together.

I was hoping for a quick solution that maybe one of you guys could pull out of the hat for me, but I guess the Adobe engineers didn't see a need to add this type of functionality to the program.

Thanks for your assistance!

Likes

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
Reply
Loading...
Aug 15, 2017 0
Adobe Community Professional ,
Aug 15, 2017

Copy link to clipboard

Copied

Oh. Sorry. I wasn't suggesting that I do it for a fee. I'm saying it's more tedious than difficult.

Likes

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
Reply
Loading...
Aug 15, 2017 0