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

How can I remove field colours when printing a pdf form

Explorer ,
May 28, 2024 May 28, 2024

Hi I have created a form and set the field colours as per our requirements, however, when I print the form the field colours also print. I have found the following code which works great when I print:

 

for(var i=0;i<this.numFields;i++)

this.getField(this.getNthFieldName(i)).fillColor = ["T"];

 

However,  this switches off all field colours for all forms that I open from then on which is not ideal. The problem I have is that I can switch the colour back on, but all fields are one colour, but as you can see in the attached document certain fields need to be certain colours, what is the easiest way to reverse the removal of field colours ensuring that the correct colours end up in the correct fields?

 

Also is there an easier way to set the field colours than what I have done?

 

Any assistance would be greatly appreciated.

 

Cheers

Nicole

TOPICS
PDF forms
1.6K
Translate
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 ,
May 28, 2024 May 28, 2024

How does it affect other files, where do you use script?

When you want to print, you can run a script from console, or you can add a script to the file document actions 'Document Will Print'.

Once you're done printing, don't save the file or if you need filled in fields, save before printing under a different name so you also have the original file.

Translate
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 ,
May 28, 2024 May 28, 2024

I placed in the Document JavaScripts and every other form that I opened up after I printed this one all fields were white instead of having the standard bluish/purple background. I then tried the script in the Document Will Print area of Document Actions and it would not work at all.

Translate
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 ,
May 29, 2024 May 29, 2024

It can not affect other files. There must have been something else you did.

But the bluish/purplish fill color of the fields you see is a setting of the application to highlight fields on the screen. It does not carry over when the file is printed, so there's no need to disable it.

Translate
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 ,
May 29, 2024 May 29, 2024

Sorry I didn't explain properly. I switched the Highlight Existing Fields off under the Prepare Form area so that I could set the field colours that were needed under each fields Properties and Appearance. This was the only way that I could get the background colour to be the same for everyone that opened the form. But because I have the Highlight Existing Fields off for this form every form that I open also has the Highlight Existing Fields off. Is there a way to set the field colour so that it isn't the standard bluish/purple without switching the Highlight Existing Fields off and so that I can print the form without the background colour for all fields? 

Translate
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 03, 2024 Jun 03, 2024
LATEST

Not really. What you can do is add a command in your file that re-enables the fields highlighting when it is closed, but while it is opened it will be disabled for all other files opened at the same time.

Translate
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 ,
May 29, 2024 May 29, 2024

At the event "Document Will Print" save the field object with the color settings in an array. Then change the color of the fields.

At the event "Document Did Print" restore the color of the fields.

Translate
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