• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

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

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

Views

550

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
community guidelines
Community Expert ,
Nov 11, 2020 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".

Votes

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

 

Votes

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
community guidelines
Community Expert ,
Nov 11, 2020 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.

Votes

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
community guidelines
LEGEND ,
Nov 11, 2020 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.

Votes

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
community guidelines
Community Expert ,
Nov 11, 2020 Nov 11, 2020

Copy link to clipboard

Copied

LATEST

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.

 

 

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

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
community guidelines