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
Barcode Create
  |  
Home ›› XDoc.PDF ›› VB.NET PDF: Create Barcode

VB.NET PDF - How to Add Barcode on PDF Page in VB.NET


Add Linear and 2D Barcodes on PDF Document in VB.NET Class




This VB.NET PDF barcode creator add-on, which combines the PDF reading add-on with barcode creator plug-in, can help developers finish three tasks programmatically: generating industry-standard 1d & 2d barcode, customizing created barcode with desired imaging properties and adding & burning barcode image on source PDF file at desired location. Following is the article layout.




Use VB.NET Demo to Create Barcode in PDF Document



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


  RasterEdge.Imaging.Barcode.Creator.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.PDF;


  using RasterEdge.Imaging.Barcode.Creator;


This is a simple VB.NET demo that explains how to create a barcode in PDF document.




Dim inputFilePath As String = Program.RootPath + "\\" + "1.pdf"
Dim outputFilePath As String = Program.RootPath + "\\" + "1_barcode.pdf"

' open a document and get the page object
Dim doc As PDFDocument = New PDFDocument(inputFilePath)
Dim page As PDFPage = doc.GetPage(0)

' create a CODE128 barcode
Dim barcode As Linear = New Linear()
barcode.Type = RasterEdge.Imaging.Barcode.Creator.BarcodeType.CODE128
barcode.Data = "ABC123"
' draw barcode in the 1st page at position (300F, 400F)
barcode.DrawBarcode(page, 300.0F, 400.0F)

' output the document
doc.Save(outputFilePath)