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
  • 8214 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.

Known Participant
July 7, 2019

The JavaScript code is very simple. Let's say you want to check it for page 1 of the file. You can use this code to do it:

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.");


Thank you so much for this JavaScript Code.  I'm looking exactly for this.

But how can I execute or call this JavaSripct Code in my VBA Code? And the second question is I would like

to set my boolean variable blnAnnotaions to false or true regarding from the result of the variable annots from your JavaScript Code.

Sub CheckPDFAnnotations()

Dim App As Acrobat.CAcroApp
Dim PDDoc As Acrobat.CAcroPDDoc
Dim i As Long

Dim blnAnnotations as Boolean

Set App = CreateObject("AcroExch.App")
Set PDDoc = CreateObject("AcroExch.PDDoc")
PDDoc.Open ("C:\Users\Josua\Documents\Test01.pdf")

End Sub

Bernd Alheit
Community Expert
Community Expert
July 4, 2019

With Acrobat Javascript you can test/check the annotations.