Highlighted

How to Set global properties for text field, checkbox and radio button. ?

New Here ,
Nov 11, 2020

Copy link to clipboard

Copied

Acrobat DC.

I want to set the text field properties as 

  1. Font size - 9, font colour - dark blue, font Helvetica, height - 0.17 Inch.

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.

TOPICS
Acrobat SDK and JavaScript, How to, PDF forms

Views

37

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

How to Set global properties for text field, checkbox and radio button. ?

New Here ,
Nov 11, 2020

Copy link to clipboard

Copied

Acrobat DC.

I want to set the text field properties as 

  1. Font size - 9, font colour - dark blue, font Helvetica, height - 0.17 Inch.

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.

TOPICS
Acrobat SDK and JavaScript, How to, PDF forms

Views

38

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
Nov 11, 2020 0
Engaged ,
Nov 11, 2020

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".

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...
Nov 11, 2020 2
New Here ,
Nov 11, 2020

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 ... 

 

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...
Nov 11, 2020 0
Engaged ,
Nov 11, 2020

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.

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...
Nov 11, 2020 0
Adobe Community Professional ,
Nov 11, 2020

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/

 

and: https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/#t=Acro12_MasterBook%2FJS_API_Acro...

 

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.

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...
Nov 11, 2020 1
Adobe Community Professional ,
Nov 11, 2020

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.

 

 

 

 

 

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...
Nov 11, 2020 0