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
  • 8189 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 8, 2019

I deleted the addMenuItem command in my  CheckAnnots.js [in C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Javascripts]

Thanks for this tipp. That's my js function:

function CheckAnnots(doc, nPage)

doc.syncAnnotScan();  

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

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

else return true; 

My VBA Code is

Sub CheckPDFAnnotations()

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

Dim blnAnnotations As Boolean

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

Set jso = PDDoc.GetJSObject

blnAnnotations = jso.CheckAnnots("C:\Users\Josua\Documents\Test01.pdf", 0)

End Sub

But the last row     jso.CheckAnnots("C:\Users\Josua\Documents\Test01.pdf", 0)    does not work.

The Call of the js function from VBA hat to be changed? Perhaps someone can help me?


The first parameter needs to be a Document object, not the path to one.

Bernd Alheit
Community Expert
Community Expert
July 4, 2019

With Acrobat Javascript you can test/check the annotations.