In "test.pdf", there are 30 annotations, but "GetAnnot(nIndex)" can just returns the first 2 annotations, though variable "nIndex" is incremented from 0 to 30, variable "N" repeat 0 and 1.
The pdf file is fine, and other pdf files have the same problem, What's the problem?
Acrobat X , VB
Code:
Private Sub Form_Load()
Dim PDDoc As Acrobat.AcroPDDoc
Dim PDPage As Acrobat.AcroPDPage
Dim PDAnnot As Acrobat.AcroPDAnnot
Dim NumAnnots As Long
Dim NumPage As Long
Dim I As Long
Dim nIndex As Long
Dim AnTxt As String
Dim N As Long
Set PDDoc = CreateObject("AcroExch.PDDoc")
PDDoc.Open "D:\test.pdf"
NumPage = PDDoc.GetNumPages
If NumPage > 0 Then
For I = 0 To NumPage - 1
Set PDPage = PDDoc.AcquirePage(I)
NumAnnots = PDPage.GetNumAnnots()
If NumAnnots > 0 Then
For nIndex= 0 To NumAnnots - 1
Set PDAnnot = PDPage.GetAnnot(nIndex)
N = PDPage.GetAnnotIndex(PDAnnot)
AnTxt = PDAnnot.GetContents()
Next
End If
Next
End If
PDDoc.Close
End Sub