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

VB.NET PDF Viewer, Reader Library
How to open, display, add, delete, Adobe PDF file attachment using VB.NET in .net web, windows, wpf application


Sample Codes for Visual Basic .NET Users to attach files on PDF in vb.net class. ASP.NET Annotate PDF function is based on .net PDF Annotate SDK.













VB.NET add attach file annotation to pdf document


Dim inputFilePath As String = Program.RootPath + "\\" + "2.pdf"
Dim outputFilePath As String = Program.RootPath + "\\" + "Annot_7.pdf"

' open a PDF file
Dim doc As PDFDocument = New PDFDocument(inputFilePath)
' get the 1st page
Dim page As PDFPage = doc.GetPage(0)

' create the annotation
Dim annot As PDFAnnotFileAttach = New PDFAnnotFileAttach()

annot.Position = New PointF(100.0F, 100.0F)
annot.FilePath = "C:\AttachmentFile.txt"

' add annotation to the page
PDFAnnotHandler.AddAnnotation(page, annot)

' save to a new file
doc.Save(outputFilePath)




VB.NET read attach file annotation from pdf document


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

Dim doc As PDFDocument = New PDFDocument(inputFilePath)
Dim annots = PDFAnnotHandler.GetAllAnnotations(doc)
For Each annot As IPDFAnnot In annots
    If TypeOf annot Is PDFAnnotFileAttach Then
        Dim obj As PDFAnnotFileAttach = annot
        Console.WriteLine("Color: " + obj.Color.ToString())
    End If
Next




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)