Skip to main content
Known Participant
July 2, 2019
Answered

How to check if a PDF Page has no annotations like comments or Fill and Sign

  • July 2, 2019
  • 3 replies
  • 8211 views

Hello,

is it possible to check if a PDF page has no annotations like comments of Fill and Sign. I'm working with Adobe Acrobat and VBA.

I need a function with result =  false if there is no Comment or Fill and Sign on a page of a PDF document. I hope someone can help me with a little bit code.

Best Regards from Germany

Josua

This topic has been closed for replies.
Correct answer Bernd Alheit

You can use the VB Javascript bridge. Documentation is in the Acrobat SDK.

3 replies

Legend
July 9, 2019

You don’t need to make and call a function. You can’t define functions through JSObject so far as I know.

Known Participant
July 4, 2019

Hello Bernd,

thanks for your answer. How can I implement it in VBA?

Best Regards

Josua

Bernd Alheit
Community Expert
Bernd AlheitCommunity ExpertCorrect answer
Community Expert
July 4, 2019

You can use the VB Javascript bridge. Documentation is in the Acrobat SDK.

try67
Community Expert
Community Expert
July 7, 2019

Does it mean I put the 4 lines of javasript code

this.syncAnnotScan(); 

var annots = this.getAnnots({nPage: 0}); 

if (annots==null || annots.length==0) app.alert("There are NO annotations on this page."); 

else app.alert("There are annotations on this page.");

in a plain text editor and save the file for instance as  CheckAnnot.js    (javasript file).

Can I save this file in some Directory or in a Special Directory? Or what do you mean exactly with Folder Level function?

How Looks then the call in VBA for my example?


If you put it in a folder-level script it needs to be inside a function, which you then call from your code.

The function could be something like this:

function CheckAnnots(doc, nPage) {

    doc.syncAnnotScan();

    var annots = doc.getAnnots({nPage: nPage});

    if (annots==null || annots.length==0) return false;

    else return true;

}

You then can call it like this:

var bAnnotations = CheckAnnots(this, 0);

Bernd Alheit
Community Expert
Community Expert
July 4, 2019

With Acrobat Javascript you can test/check the annotations.