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
Highlight text
  |  
Home ›› XDoc.PDF ›› VB.NET PDF: Highlight Text

VB.NET PDF - Highlight PDF Text in VB.NET


Online VB.NET Tutorial of How to Highlight Selected PDF Text on PDF Page in VB.NET




Add Annotation – Highlight Text Overview



Users will often face the situation that you may need to emphasize the most important information from all text on a PDF page. Highlight text is such a functionality which allow users to give prominence to key words or sentences. RasterEdge XDoc.PDF SDK is a multifunctional PDF document annotation tool, which can highlight text with a simple piece of VB.NET programming demo code.


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.




How to VB.NET: Highlight Selected Text on PDF Page



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;


This sample code shows how to highlight PDF text 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)