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

Access format field property with a script

Community Expert ,
May 16, 2019 May 16, 2019

Is it possible to extract the formatting property of a text field with a script?

TOPICS
Acrobat SDK and JavaScript
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 16, 2019 May 16, 2019

No, all the field formatting options are actually predefined scripts. And there is no way from script, to get access to an existing script. It would be really helpful if you could, but you can't

Translate
Community Expert ,
May 16, 2019 May 16, 2019

What do you mean by "formatting property", exactly?

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
Community Expert ,
May 16, 2019 May 16, 2019

In the field properties, the format tab where you can format numbers, dates, percentages, etc.  Is there a script that will tell what the formatting, if any, is for that field?

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
Community Expert ,
May 16, 2019 May 16, 2019

No, all the field formatting options are actually predefined scripts. And there is no way from script, to get access to an existing script. It would be really helpful if you could, but you can't

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

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
Community Expert ,
May 16, 2019 May 16, 2019

Thanks Thom.  I realize it's probably because there are unlimited variations, but even if a script could tell me the formatting is not "none" would be helpful.

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
Community Expert ,
May 16, 2019 May 16, 2019

Nope, not possible.

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
Community Expert ,
May 16, 2019 May 16, 2019

Yeah, short of actually parsing the binary PDF file contents, you can't get access to anything about the field formatting info.

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

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
Community Expert ,
May 16, 2019 May 16, 2019

I figured it out.  I'm trying to get a list of text fields that are formatted (but no details).  I looped through the fields and I set the dirty flag to false, forced the formatting to none using setAction(), tested the dirty flag (if true, the formatting changed from something to none, if false nothing changed - the formatting was already none).

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
Community Expert ,
May 16, 2019 May 16, 2019

Ha ha, very clever. Elimination strategy

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

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
Community Expert ,
May 16, 2019 May 16, 2019
LATEST

Nice one!

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
Community Expert ,
May 16, 2019 May 16, 2019

I see. Unfortunately, no, you can't access it. Nor can you access the formatted value, only the actual one.

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
Community Expert ,
May 16, 2019 May 16, 2019

Thanks.

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