Skip to main content
saratogacoach
Inspiring
December 23, 2016
Answered

Get Object Name Using Javascript

  • December 23, 2016
  • 2 replies
  • 2718 views

Hi,

Using Acrobat Professional DC, wondered if it is possible to create a script to get the name of an object for example as an event target (for example, on entering a page?).

If I can get an object's name, then possibly I could add a script to change its fill color or some other property?

Am learning scripting in Acrobat, have been reading the scripting API, correct syntax, and would appreciate any help to get an object's name based on an event.

Thank you in advance.

Stephen

This topic has been closed for replies.
Correct answer Test Screen Name

The drawn content you make with FrameMaker is not bundled into objects, does not have names, and such content cannot have its attributes read or changed from JavaScript at all.

2 replies

Test Screen NameCorrect answer
Legend
December 23, 2016

The drawn content you make with FrameMaker is not bundled into objects, does not have names, and such content cannot have its attributes read or changed from JavaScript at all.

saratogacoach
Inspiring
December 23, 2016

Is there a way to create a graphic object in Acrobat DC, get a name for it and use the name in a script?

For example, I would draw the graphic object (rectangle, circle, etc. ) in Acrobat (if this can be done), get and use its object name in a script added to a button, to let the person viewing the PDF change the background color/fill.

That would also work, if possible?

try67
Community Expert
Community Expert
December 23, 2016

Yes, you can do it using comments (annotations, in their technical name), or form fields (but those are only rectangular).

Legend
December 23, 2016

What sort of object exactly? Most objects don't have a name.

saratogacoach
Inspiring
December 23, 2016

I am using Adobe Framemaker to create a guide that is published to Acrobat PDF (using my installed Acrobat DC printer-this is how Adobe Framemaker seems to publish to PDF).

So, if I add a graphic shape (draw a rectangle with a fill) in Framemaker, and would like to create a new script in Acrobat to change that graphic object (change its color, transparency, etc.), I am not sure what to use for an object name that will be recognized and work in Acrobat's Javascript. Not sure how to reference it in the script?

I tested using a drawn rectangle, and when I view it in Acrobat's Content pane, on the page where the rectangle is, the rectangle seems to have 5 "Path" names, each the same name ("Path") one for each side, and the fifth "Path" is the whole rectangle. So, if I wanted to write a script to change a feature (fill, transparency, etc.) for this object, I am unsure how to call this object in the script?

try67
Community Expert
Community Expert
December 23, 2016

Not possible with Acrobat JavaScript.

On Fri, Dec 23, 2016 at 2:29 PM, saratogacoach <forums_noreply@adobe.com>