How to Start Convert PDF Work with PDF Modules PDF Document PDF Pages Text Image Graph & Path Annotation, Markup & Drawing Redaction Security Digital Signature Forms Watermark Bookmark Link File Attachment File Metadata Printing Work with Other SDKs Barcode read Barcode create OCR Twain

Using VB.NET PDF Annotation Library
How to create, edit, update, remove PDF file annotations and drawings using VB.NET


Sample Codes for Visual Basic .NET Users to create, edit pdf file existing annotations, comments on PDF in VB.NET Class. ASP.NET Annotate PDF function is based on .net PDF Annotate SDK.













VB.NET retrieve all annotations information from a PDFDocument


Dim inputFilePath As String = Program.RootPath + "\\" + "1_Annots.pdf"

Dim doc As PDFDocument = New PDFDocument(inputFilePath)
Dim annots = PDFAnnotHandler.GetAllAnnotations(doc)

Console.WriteLine("Number of Annotations: " + annots.Count)
If annots.Count > 0 Then
    For Each annot As IPDFAnnot In annots
        Console.WriteLine("Annotation")
        Console.WriteLine("  Page:     " + annot.PageIndex)
        Console.WriteLine("  Aritst:   " + annot.Artist)
        Console.WriteLine("  Subject:  " + annot.Subject)
        Console.WriteLine("  Content:  " + annot.Content)
    Next
End If




vb.net retrieve all annotations information from a PDF page


Dim inputFilePath As String = Program.RootPath + "\\" + "1_Annots.pdf"

Dim doc As PDFDocument = New PDFDocument(inputFilePath)
Dim page As PDFPage = doc.GetPage(0)
Dim annots = PDFAnnotHandler.GetAllAnnotations(page)




VB.NET delete all annotations from pdf document


Dim inputFilePath As String = "C:\1_Annots.pdf"

Dim doc As PDFDocument = New PDFDocument(inputFilePath)
' get all annotations in the 1st page
Dim page As PDFPage = doc.GetPage(0)
Dim annots = PDFAnnotHandler.GetAllAnnotations(page)
' remove all annotations in the 1st page
PDFAnnotHandler.DeleteAnnotation(doc, annots)




VB.NET retrieve annotation popup note window's properties


Dim inputFilePath As String = "C:\Annot_1.pdf"

Dim doc As PDFDocument = New PDFDocument(inputFilePath)
Dim annots As List(Of IPDFAnnot) = PDFAnnotHandler.GetAllAnnotations(doc)
For Each annot As IPDFAnnot In annots
    If TypeOf annot Is IPDFPopupAnnot Then
        Console.WriteLine("Annotation has popup window")

        Dim obj As IPDFPopupAnnot = annot
        Console.WriteLine("Is open in the begin:  {0}", obj.Popup.IsOpen)
        Console.WriteLine("Popup window boundary: {0}", obj.Popup.Boundary.ToString())
    Else
        Console.WriteLine("Annotation has no popup window")
    End If
Next




VB.NET retrieve annotation flags


Dim inputFilePath As String = "C:\Annot_1.pdf"

Dim doc As PDFDocument = New PDFDocument(inputFilePath)
Dim annots As List(Of IPDFAnnot) = PDFAnnotHandler.GetAllAnnotations(doc)
For Each annot As IPDFAnnot In annots
    Console.WriteLine("Annotation Flags")
    Console.WriteLine("  Invisible:       {0}", annot.IsInvisible)
    Console.WriteLine("  Hidden:          {0}", annot.IsHidden)
    Console.WriteLine("  Print:           {0}", annot.IsPrint)
    Console.WriteLine("  No Zoom:         {0}", annot.NoZoom)
    Console.WriteLine("  No Rotate:       {0}", annot.NoRotate)
    Console.WriteLine("  No View:         {0}", annot.NoView)
    Console.WriteLine("  Read Only:       {0}", annot.IsReadOnly)
    Console.WriteLine("  Locked:          {0}", annot.IsLocked)
    Console.WriteLine("  Toggle No View:  {0}", annot.IsToggleNoView)
    Console.WriteLine("  Locked Contents: {0}", annot.IsLockedContents)
Next




VB.NET set annotation flags


Dim inputFilePath As String = "C:\2.pdf"
Dim outputFilePath As String = "C:\Annot_1.pdf"

' create the annotation
Dim annot As PDFAnnotDeleteLine = New PDFAnnotDeleteLine()
annot.StartPoint = New PointF(100.0F, 200.0F)
annot.EndPoint = New PointF(300.0F, 400.0F)

' set annotation flags
annot.IsInvisible = False
annot.IsPrint = True
annot.NoRotate = True
annot.NoZoom = True

' add annotation
PDFAnnotHandler.AddAnnotation(inputFilePath, 1, annot, outputFilePath)