|
VB.NET PDF Editor SDK Library
How to add, edit, retrieve, delete PDF file text callout annotations using VB.NET
Sample Codes for Visual Basic .NET Users to edit text callout on PDF in vb.net Class.
ASP.NET Annotate PDF function is based on vb.net PDF Annotate SDK.
VB.NET add text callout annotation to pdf document
Dim inputFilePath As String = Program.RootPath + "\\" + "2.pdf"
Dim outputFilePath As String = Program.RootPath + "\\" + "Annot_10.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 PDFAnnotTextCallout = New PDFAnnotTextCallout()
annot.StartPoint = New PointF(100.0F, 100.0F)
annot.Boundary = New RectangleF(400.0F, 500.0F, 300.0F, 80.0F)
annot.Content = "This is a text callout annotation"
' add annotation to the page
PDFAnnotHandler.AddAnnotation(page, annot)
' save to a new file
doc.Save(outputFilePath)
VB.NET read text callout annotation from pdf document
Dim inputFilePath As String = "C:\Annot_10.pdf"
Dim doc As PDFDocument = New PDFDocument(inputFilePath)
Dim annots = PDFAnnotHandler.GetAllAnnotations(doc)
For Each annot As IPDFAnnot In annots
If TypeOf annot Is PDFAnnotTextCallout Then
Dim obj As PDFAnnotTextCallout = annot
Console.WriteLine("Textbox Boundary: " + obj.GetTextBoxBoundary().ToString())
Console.WriteLine("Textbox Border Color: " + obj.LineColor.ToString())
Console.WriteLine("Textbox Border Width: {0}", obj.LineWidth)
Console.WriteLine("Textbox Fill Color: " + obj.FillColor.ToString())
Console.WriteLine("Callout Line: ")
For Each pt As PointF In obj.GetEndPoints()
Console.WriteLine(" " + pt.ToString())
Next
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)
|