title: How to check security of PDF file from excel?
body: <p>Using <i>Acrobat.tlb</i> reference I am trying to check, if PDF file is secured / has any restrictions set.
  I checked Acrobat JavaScript Scripting Reference, but I am doing something wrong:</p>
  
  <pre><code>Sub CheckPDFsecurity()
  Dim oPDDoc As Acrobat.AcroPDDoc
  Dim oPapp As Acrobat.AcroApp
  Dim oJso As Object
  Dim oSec As Object
  Dim arrPolicies As Variant
  Dim i As Integer
  
  Set oPapp = CreateObject("AcroExch.App")
  oPapp.MenuItemExecute ("COMP:AddBack")
  Set oPDDoc = CreateObject("AcroExch.PDDoc")
  oPDDoc.Open ("D:\test\test2.pdf")
  Set oJso = oPDDoc.GetJSObject
  Set oSec = oJso.security
  arrPolicies = oJso.getLegalWarnings(True)
  
  For i = 0 To UBound(arrPolicies)
       MsgBox (arrPolicies(i))
  Next i
  
  oPDDoc.Close
  Set oPDDoc = Nothing
  End Sub
  </code></pre>
  
  <p>Please would be someone so kind and help me with correct way of checking PDF file security setting.
  Thank you!</p>