Copy link to clipboard
Copied
Hi,
I am trying to export annotations from a pdf to excel using a macro.
The code is working except for the fact that if I try to assign parameters to GetAnnots() I receive an error message saying "Named argument not found".
If I don't assign any parameter to GetAnnots the code works but the comments are not in order by page.
This is the code i wrote for the javascript object:
''Access JSO object
Dim JSO As Object
Set JSO = AcroPDDoc.GetJSObject
JSO.console.Show ''show javascript console
''get total number of annotations
JSO.syncAnnotScan
''get list of annotations in document
Dim Annotations() As Object
Annotations = JSO.GetAnnots(nSortBy:=ANSB_Page, bReverse:=True)
Did anybody have the same issue?
Thanks
Copy link to clipboard
Copied
Hi @riccardom15921476 ,
This particular forum is for plugins and extensions hosted on the Adobe Exchange. Are you making a plugin of some sort?
Is this an Acrobat question? If so, the forum moderators might consider moving this post to Acrobat Scripting or the Acrobat SDK area.
Regardless, here's an older thread about GetAnnots() that might be helpful.
Hope this is helpful!
Copy link to clipboard
Copied
Hi Erin,
Thanks for your reply. No it is not a plugin, it is just an excel macro. Sorry I didn't know this area was only for plugins, I will try to post it on the groups you suggested. Unfortunately the previous post doesn't answer my question but thanks anyway for the tip!
Copy link to clipboard
Copied
Actually, this is an SDK issue.
If you want to pass parameters into the getAnnots() function, you will need to pass them all, and you'll need to use the values for the constants, not the constant name. This is because the "getAnnots" function in the JavaScript model has two ways to get arguments: passed in like a normal function, or parameterized arguments through an object passed into it. In VB you can't pass the object. Or maybe you can, but I haven't found a way to do it, or seen any examples of this.
The other technique for running JS from a VB program, is to put all the JS in a folder level function, then call that function.