Skip to main content
January 21, 2020
Answered

How to get the "Icon Label's Name" of the Icon used in the "Image Insertion Field" ??

  • January 21, 2020
  • 1 reply
  • 798 views

We have created several image insertion fields in the form.

In this field can insert own "Icon".
And it can set the "Label Name".
These can be displayed in the image insertion field.

 

I want to manipulate this "Icon Label Name" with Javascript.

 

Please be attention. It's not "Field Name".

This means that this field has a "Field Name", "Inserted Icon", and "Inserted Icon's Label Name".
What I want to manipulate is "Inserted Icon's Label Name".

 

I don't know how to do this.
Nowhere can I find a way.

 

"Field name" can be obtained in the following ways.
---
var Peace01 = this.getField("Peace_01");
var Peace01label = Peace01.name;
event.value = Peace01label;
---

 

I tried the following, thinking that maybe I should rewrite the second line, but all returned an error.

 

var Peace01label = Peace01.label;
var Peace01label = Peace01.labelName;
var Peace01label = Peace01.note;
var Peace01label = Peace01.tag;
var Peace01label = Peace01.id;
var Peace01label = Peace01.caption; so on...

 

I can't find any reference materials anywhere, so I tried all the words that came up....

 

I want to also rewrite as well as get, but I do not know at all.

 

Please help me ..

This topic has been closed for replies.
Correct answer Thom Parker

You would gain a lot by reading the Acobat JavaScript Refence, rather then guessing at PDF object properties. 

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

 

You can also learn a great deal about scripting Acrobat and PDFs here:

https://www.pdfscripting.com/public/main.cfm

 

I believe that what you are calling an "Image insertion field" is really a button field.

The label for a button field can be obtained with this script

field.buttonGetCaption();

 

where "field" is the field object. Look it up in the reference. 

 

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
January 22, 2020

You would gain a lot by reading the Acobat JavaScript Refence, rather then guessing at PDF object properties. 

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

 

You can also learn a great deal about scripting Acrobat and PDFs here:

https://www.pdfscripting.com/public/main.cfm

 

I believe that what you are calling an "Image insertion field" is really a button field.

The label for a button field can be obtained with this script

field.buttonGetCaption();

 

where "field" is the field object. Look it up in the reference. 

 

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