Copy link to clipboard
Copied
I have posted this same issue on SO as well: javascript - Acrobat SDK IAC Modify Annotation Points Property - Stack Overflow
What I am trying to do at the moment was what I thought to be very trivial but is proving to be a confusing exercise. I simply wish to create a new annotation that is a line and set the points property to a specific value. When the object is initialized and set to "Line" type I can read the default points property, which it's value and datatype during debugging are as follows:
So I tried a very simple assignment operation for testing by doing the following:
oLineAnnotation.points = New Object(1) {New Object(1) {100.0, 100.0}, New Object(1) {100.0, 100.0}}
This will throw the following exception: The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)).
I have tried other methods of assignment as well, i.e writing back to specific index in the property array:
oLineAnnotation.points(0) = New Double(1) {100, 100}
This doesn't throw an exception, but nothing is written back to the property. I've tried varying methods of writing back to the property but nothing has worked so far (not working being an exception is either thrown OR no exception is thrown but the points property doesn't change at all to the specified value after assignment)
Copy link to clipboard
Copied
My first thought is to eliminate complexities in the OLE object model (since it cannot do everything).
Can you access and change this information if you code JavaScript directly and run it from the console?
Copy link to clipboard
Copied
I've just tested directly from the javascript console and I can indeed read and write back to this property as one would expect. The API documentation says that this property is read and write, but why can I not read and write to it via IAC using the javascript interface? Is there any clear documentation in regards to IAC around this specific problem of the points property? I would like to see it if possible, and I would also like some clear guidance documentation on the limitations of IAC so I can avoid surprises down the road.
I have briefly skimmed https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/iac_developer_guide.pdf​ and I cannot find any mention of the points property.
Thank you for your assistance so far.
Copy link to clipboard
Copied
Unfortunately the mapping of JavaScript objects into COM objects is never perfect, they are different object models. But since you now know that a regular script can do the task, you can use your external app to (1) create a string containing the required JavaScript (2) use AFExecuteThisJavaScript to execute the string.
Fortunately your action is only a write; using this technique to read data is more awkward (but still possible).