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 box
  |  
Home ›› XDoc.PDF ›› VB.NET PDF: Add Text Box

VB.NET PDF - Add Text Box to PDF Page in VB.NET


Provide VB.NET Users with Solution of Adding Text Box to PDF Page in VB.NET Project




Add Annotation – Add Text Box Overview



Adding text box is another way to add text to PDF page. With RasterEdge XDoc.PDF annotation control, users can also perform this work on PDF page in their VB.NET program.


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: Add Text Box to Specified Position



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;


Please copy sample code below to your VB.NET class program for adding text box on specified position of PDF page.




Dim inputFilePath As String = Program.RootPath + "\\" + "2.pdf"
Dim outputFilePath As String = Program.RootPath + "\\" + "Annot_9.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 PDFAnnotTextBox = New PDFAnnotTextBox()

annot.Boundary = New RectangleF(100.0F, 100.0F, 400.0F, 300.0F)

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

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