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

Form Field Text Properties: Access with Javascript?

People's Champ ,
May 01, 2016 May 01, 2016

Hi,

I'm wondering if it's possible to access the complete set of form field text properties with Javascript.

The basic set is available under the Field object, but I'm looking for the other stuff that is available specifically for rich text fields, such as the following paragraph properties:

Indents (left and right, first line indent, hanging indent), vertical alignment (top, bottom, middle), space above and below, and leading (line spacing).

All this stuff is available if you place your cursor in a rich text field and hit Ctrl-E to open the Form Field Text Properties, and then click on "More".

So I'm wondering if it's also accessible via JS, because I can't find anything in the documentation about it.

Many thanks for any help!

Ariel

TOPICS
Acrobat SDK and JavaScript , Windows
1.5K
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

correct answers 1 Correct answer

Community Expert , May 01, 2016 May 01, 2016

Some rich text properties are available, but not the ones you mentioned,

I'm afraid.

Study the Span object to find out which ones are.

Translate
Community Expert ,
May 01, 2016 May 01, 2016

Some rich text properties are available, but not the ones you mentioned,

I'm afraid.

Study the Span object to find out which ones are.

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
People's Champ ,
May 01, 2016 May 01, 2016

Thanks, that's what I was afraid of.

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
Advocate ,
May 01, 2016 May 01, 2016

If I remember correctly, there are a few undocumented properties in the spawn object; you might access one from the console and use the for…in statement to get an overview of what is actually available.

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
People's Champ ,
May 01, 2016 May 01, 2016

Thanks, that's a good idea. I didn't get very far with it, though.

Running this:

f = this.getField("Text Field 1").richValue[0]

for (i in f){

console.println(i);

}

Only produced this list:

alignment

fontFamily

fontStretch

fontStyle

fontWeight

text

textColor

textSize

All of which are documented.

And modifying the first line to:

f = this.getField("Text Field 1").richValue[0].constructor;

was even less helpful, returning:

function Object() {

    [native code]

}

I'm not convinced I'm getting to the actual Span object itself this way, though.

Am I missing anything?

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
Advocate ,
May 01, 2016 May 01, 2016

This is definitely the right direction.

I must admit that it is quite some time ago that I did it, but I got a few more properties… gimme a bit of time to dig up the code.

You might try to set some more properties via user interface.

Also, in order to get the values, you could use this line of code:

console.println(i + "    " + f) ;

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
People's Champ ,
May 01, 2016 May 01, 2016

If you can find your old code, that would be great.

I tried setting some extra properties via the UI (double line spacing, indent), but didn't see anything new when rerunning the script. Good idea though.

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
People's Champ ,
Jun 07, 2016 Jun 07, 2016
LATEST

maxwyss wrote:

I must admit that it is quite some time ago that I did it, but I got a few more properties… gimme a bit of time to dig up the code.

Any luck? It would still be very helpful for me.

Thanks,

Ariel

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