Copy link to clipboard
Copied
Acrobat DC.
I want to set the text field properties as
For radio button field; fontsize- Auto, text color - dark blue, Border Color - black, Fill color - White, Line style- solid, line thickness-thin, width and height - 0.14, checkbox style - cross.
Same property for check box also.
If possible, I have to run a script on each form I create. Can anybody help.
Thank you.
Copy link to clipboard
Copied
When you set up your field right click on it (while still in prep form) and select "use current properties as new defaults".
Copy link to clipboard
Copied
Thank you.
I already have some set of checkbox and radio button , is there any way to use javascript to apply my properties.
For text field ,i i know how to use font, font size and color but don't know the code to change the height to 0.17 Inch ...
Copy link to clipboard
Copied
For font try textSize, e.g. event.target.textSize = 12.24;
There are some tools online that convert adobe points to inches which would be 0.17 inches = 12.24 points but how accurate it is I don't know. Also i think it will round to 12 so how you will use thats up to you.
Copy link to clipboard
Copied
To set the size of a field you need to use the "rect" property. With it, you set the location of the left, top, right, and bottom coordinates. For more information on doing this with JavaScript, see: https://acrobatusers.com/tutorials/auto_placement_annotations/
So it's possible to run a script after you add fields that sets the height of each to a particular value depending on field type, but you'd have to decide how to do that. For example, if a text field were 0.25" tall, and you wanted to adjust it to 0.17", would you increase the bottom border, decrease the top border, or adjust both.
Copy link to clipboard
Copied
Here's an article on setting field size and location.
https://www.pdfscripting.com/public/PDF-Page-Coordinates.cfm
You can write a console window script to modify all, or a set of the fields on a PDF.
Like this;
for(var i=0;i<this.numFields;i++)
{
oFld = this.getField(this.getNthFieldName(i));
if(oFld == < some condition>)
{
oFld.textColor = ...
oFld.textSize = ...
oFld.rect = ...
}
}
This script loops through all the fields on the form. If a field passes the sepcified condition (ex, field type ="text"), the several properties are modified.