Copy link to clipboard
Copied
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
1 Correct answer
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.
Copy link to clipboard
Copied
What sort of object exactly? Most objects don't have a name.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Not possible with Acrobat JavaScript.
On Fri, Dec 23, 2016 at 2:29 PM, saratogacoach <forums_noreply@adobe.com>
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Yes, you can do it using comments (annotations, in their technical name), or form fields (but those are only rectangular).
Copy link to clipboard
Copied
How would I get an object name to use in a script?
I tried by using Commenting, drew a blue circle (object name: "Circle"). What is the object name if I want to use it in a script to for example change the fill color to green?
If I create 10 circles on 10 different pages, and each has the same name ("Circle"), how do I identify the "Circle" on page 4 in a script to only change that one circle's fill color? Is it Page4.Circle ?
Copy link to clipboard
Copied
You need to study the relevant methods of properties relating to
annotations. Each one has a name property with a unique value.
Copy link to clipboard
Copied
Thank you.
I'll do some reading. (Hopefully can find this information in the Adobe JavaScript API guide?)
Copy link to clipboard
Copied
Correct. Focus on the Annotation object and the relevant methods of the Document object (namely getAnnot, getAnnots and syncAnnotScan).
Copy link to clipboard
Copied
Thank you.

