Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
'Create a new PDF document.
Dim pdf As New PdfDocument()
'Load the file from disk.
pdf.LoadFromFile("input.pdf")
Dim content As New StringBuilder()
For Each pdfPage As PdfPageBase In pdf.Pages
'Get all annotations from the pdfPage.
Dim annotations As PdfAnnotationCollection = pdfPage.AnnotationsWidget
For i As Integer = 0 To annotations.Count - 1
'A text annotation will attach a popup annotation since they are father-son relationship.
'The annotation information exists in the text annotation, so here we mask the blank popup annotation.
If TypeOf annotations(i) Is PdfPopupAnnotationWidget Then
Continue For
End If
content.AppendLine("Text: " & annotations(i).Text)
Dim modifiedDate As String = annotations(i).ModifiedDate.ToString()
content.AppendLine("ModifiedDate: " & modifiedDate)
Next i
Next
Me.richTextBox1.Text = content.ToString
End Sub
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim pdf As PdfDocument = New PdfDocument
pdf.LoadFromFile("input.pdf")
Dim counts As Integer = 0
For Each pdfPage As PdfPageBase In pdf. Pages
Dim annotations As PdfAnnotationCollection = pdfPage. AnnotationsWidget
For i As Integer = 0 To annotations. Count - 1
Dim content As StringBuilder = New StringBuilder
If TypeOf annotations(i) Is PdfPopupAnnotationWidget Then
Continue For
End If
content.AppendLine(annotations(i).Text)
Dim modifiedDate As String = annotations(i).ModifiedDate.ToString
content.AppendLine(modifiedDate)
Dim richTextBox As RichTextBox = New RichTextBox
richTextBox. Name = ("richTextBox" + counts)
richTextBox. Text = content. ToString
richTextBox. Width = 300
richTextBox. Height = 40
richTextBox. Location = New Point(32, (20 _
+ (counts * 50)))
Me.Controls.Add(richTextBox)
counts = (counts + 1)
Next i
Next
End Sub
Dim modifiedDate As String = annotations(i).ModifiedDate.ToString
content.AppendLine(modifiedDate)
annotations(i).Text = "1.1"
content.AppendLine(annotations(i).Text)
Dim richTextBox As RichTextBox = New RichTextBox
richTextBox.Name = ("richTextBox" + counts)
richTextBox.Text = content. ToString
'Convert String type to Double type
Dim numDouble As Double = Convert.ToDouble(richTextBox.Text)
' Update the annotation from PDF document
pdf.Pages(0).AnnotationsWidget(0).Text = "New Annotations"
' Delete the annotation from PDF document
pdf.Pages(0).AnnotationsWidget.RemoveAt(0)