VB.NET PDF: How to HTML5 PDF Viewer PDF Create PDF Export File & Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print WPF PDF Viewer Work with Other SDKs Barcode Read Barcode Create OCR Twain
Text other markups
  |  
Home ›› XDoc.PDF ›› VB.NET PDF: Drawing Markups

VB.NET PDF - Draw Markup on PDF Page in VB.NET


VB.NET Demo Codes for Draw Markup on PDF Page in VB.NET Program




Add Annotation – Draw Markup Overview



Generally, drawing markup includes: strikethrough text, underline text, highlight text, insert and replace text. This page listed a series of VB.NET sample codes to help users to do these annotation works.


Since RasterEdge XDoc.PDF SDK is based on .NET framework 2.0, users are enabled to use it in any type of a 32-bit or 64-bit .NET application, including ASP.NET web service and Windows Forms for any .NET Framework version from 2.0 to 4.5.




VB.NET DLLs: Draw Markup



In order to run the sample code, the following steps would be necessary.


Add necessary references:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XDoc.Raster.dll


  RasterEdge.XDoc.Raster.Core.dll


  RasterEdge.XDoc.PDF.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.PDF;




How to VB.NET:  Strikethrough the Selected Text



This code sample offer VB.NET solution for adding a strikethrough to selected text.




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

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

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

With annot
    .StartPoint = New PointF(100.0F, 200.0F)
    .EndPoint = New PointF(300.0F, 400.0F)
End With

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

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





How to VB.NET:  Underline the Selected Text



This demo code provide VB.NET users with a way of adding underline to the selected text on PDF Document.




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

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

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

With annot
    .StartPoint = New PointF(100.0F, 200.0F)
    .EndPoint = New PointF(300.0F, 400.0F)
End With

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

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





How to VB.NET: Insert Text At Cursor



This code sample describes how to insert text at any cursor position in VB.NET application.




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

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

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

annot.StartPoint = New PointF(100.0F, 200.0F)
annot.EndPoint = New PointF(300.0F, 400.0F)

' add annotation to the page
page.AddPDFAnnot(annot)

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





How to VB.NET:  Add Note to Replace Text



Following demo code can help users to add note to replace original text in a VB.NET program.




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

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

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

With annot
    .StartPoint = New PointF(100.0F, 200.0F)
    .EndPoint = New PointF(300.0F, 400.0F)
End With

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

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