Skip to main content
Known Participant
June 27, 2019
Answered

how to set global default font for user text in form; Acrobat DC

  • June 27, 2019
  • 3 replies
  • 12197 views

Acrobat DC. 

Create a document in Word;  Convert to PDF.

In Forms, default for user text is:  Size=Auto, Font-Helvetica, Color-Black.

I want all new forms fields in my newly designed form,which user completes, to have default of: Size=10, Font - Calibri, Color - dark blue.

This helps user input stand out from static document text, without being too different; looks almost the same if completed form is printed in B/W.

If possible, I'd like this to be the default standard and not something I have to run a script on each form I create.  But beggars can't be choosy, so I'll take what ever will work.

Thank you.

Correct answer try67

Sorry, not possible. But it is possible to change all of those fields to your desired properties with a single click after they are created, using a custom-made script.

3 replies

JR Boulay
Community Expert
Community Expert
July 20, 2023

"but you have to divide the rgb value by 255 to get the Adobe Javascript value you need to get the color you want. "

No, JavaScript is able to divide RGB values, so you don't have to:

f.textColor = ["RGB", 5/255, 18/255, 191/255];

Acrobate du PDF, InDesigner et Photoshopographe
DBF68
Participating Frequently
August 10, 2024

Very cool.  Thank you.  Anything that makes it easier is worth doing.

DBF68
Participating Frequently
June 29, 2019

Actually, you can do what you want by creating a New Action in Action Wizard and using the following Adobe JavaScript.   Go to Tools > Action Wizard > New Action > More Tools > Execute JavaScript > click on the circle with a plus sign and an arrow beneath it > click on Specify Settings > paste the provided Adobe JavaScript in the Click and Edit JavaScripts box > click OK > click on Save > give the action a name like Auto Detect Font Changer > click on Save.

 

for (var i = 0; i < numFields; i++) {

    var fName = getNthFieldName(i);

    var f = getField(fName);

    if (f.type === "text") {

f.alignment ="left";

f.textFont = "Calibri";

f.textSize = 10;

f.textColor = ["RGB",0,0,0.545];

        // Other properties go here

    }

}

 

Open the document you want to perform font type, size, and color change per user typed field, under the Action List click on Auto Detect Font Changer > click Start > and your user typed fields should now be Calibri, font size 10, font color dark blue.  To confirm that the user typed fields are Calibri, font size 10, font color dark blue, close the Action List, choose Prepare Form, right click on a user typed field, choose Properties from the pop-up menu, and under the Appearance tab you should see Text with a Font Size 10, Color Dark Blue, and Font Type Calibri.  I've tested this Auto Detect Font Changer action on a Word 2007 docx to PDF doc I'm working on and I successfully get the results you want.

 

Based on my newbie research, which you may know already, I learned there's JavaScript and there's Adobe JavaScript, which I gather have similarities and differences.  When it comes to color changes, you can use HTML red,green,blue values as a reference, but you have to divide the rgb value by 255 to get the Adobe Javascript value you need to get the color you want.  So, HTML Dark Blue is rgb (0,0,139), but Adobe JavaScript Dark Blue is rgb (0,0,0.545).

 

Also, the // in the Adobe JavaScript code are ignored when it comes to executing the code.  Although, they can prevent code from being executed if placed in front of it.  The // kind of act as the old DOS REM statement code where you can state the purpose of certain commands and code strings.

 

Hopefully that script and info help.

Participant
September 8, 2024

Thank you, @DBF68 ! I had the script years ago and couldn't remember it. 

try67
Community Expert
Community Expert
June 27, 2019

How are you adding the fields to the file?

Known Participant
June 27, 2019

I create the document in Word.  Then open Acrobat Pro 2017 and pull in file for Prepare Form.  The "Form field auto detection" is "ON".

I would like those auto detected fields to default to my choice, but also any other field added after the fact to also default.

As a bonus, I would like any text field I create (if I'm starting a document from scratch) to default my way.  Bottom line, I want it to work like the defaults in Word, even though Acrobat is NOT Word.     Note: I said in my original post that I was using Acrobat DC, but I misspoke - I recently upgraded to Pro 17.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
June 27, 2019

Sorry, not possible. But it is possible to change all of those fields to your desired properties with a single click after they are created, using a custom-made script.