• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Error trying to set parameters in GetAnnots() from Excel VBA

New Here ,
Mar 06, 2019 Mar 06, 2019

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

TOPICS
Acrobat SDK and JavaScript

Views

787

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 06, 2019 Mar 06, 2019

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!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 06, 2019 Mar 06, 2019

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!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

LATEST

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.

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines