C#: Online Guide
How To: Barcode Generator
POSTNET
POSTNET
  |  
Home ›› XImage.Barcode Generator ›› VB Barcode Generator: POSTNET

VB Imaging - Postnet Barcode Creation Tutorial


VB Code for POSTNET Barcode Generation in .NET Imaging Project




VB Image - Postnet Barcode Generator Control Overview



How to add Postnet barcode on image or document in VB.NET class application programmatically? POSTNET (short for Postal Numeric Encoding Technique), also known as USPS POSTNET Barcode, has been used by United States Postal Service to assist in mail delivery. This numeric linear barcode symbology can encode 5, 6, 9 or 11 digits, excluding check digit, in half- and full-height bars. If you know little or nothing about this Postnet barcode type but want to create this 1d Postnet barcode on image or document using VB.NET code, this VB.NET Postnet barcode creator control add-on will be your best choice. c# annotate pdf, vb.net code to merge pdf files, pdf to text vb.net, vb.net search pdf for text, vb.net itextsharp print pdf, extract image from pdf c# pdfs, c# generate pdf template.


Related .net document control helps:
c# asp.net dicom viewer: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET
c# asp.net tiff viewer: ASP.NET Tiff Viewer: view, annotate multipage Tiff images in ASP.NET MVC, WebForms using C# Control
asp.net document viewer open source: EdgeDoc:ASP.NET Document Viewer C# Control: Open, view, annotate, redact, convert documents online in C#, VB.NET, AS...
c# asp.net mvc document viewer: ASP.NET MVC Document Viewer: view, annotate, redact files on ASP.NET MVC web projects
c# asp.net text file viewer: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
asp.net mvc excel viewer: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser.
asp.net pdf document viewer c#: ASP.NET PDF Document Viewer in C#: open, display, view, annotate, redact Adobe PDF files online in ASP.NET MVC & WebForm...


This VB.NET Postnet barcode generator library allows developers and end users to easily draw and customize Postnet barcode on common image and document files, including PNG, BMP, GIF, JPEG, TIFF, PDF, Excel, PowerPoint and Microsoft Word. It also empowers VB.NET developers to specify the location of generated Postnet barcode in a target file. asp.net pdf editor component, open word document in iframe using asp.net, mvc 5 display pdf in view, asp.net tiff image viewer, show image asp.net c#, asp.net pdf viewer user control c#, preview pdf in asp.net.


RasterEdge VB.NET Barcode Creator Add-on can be seamlessly combined with image processing and management system so that users are able to process and edit created barcode image in color, black and white or grayscale. Particular barcode image manipulation functions contain resizing, printing, saving and more.


Here we list main functions of this VB.NET Postnet barcode generator control add-on.


100% clean VB.NET Postnet barcode generating solution that is written in managed C# code


Professional VB.NET Postnet barcode creator SDK that is built in .NET Framework 2.0


Able to draw & write Postnet barcode on document image in VB.NET Web and Windows applications


VB.NET developers are allowed to create Postnet barcodes that have same printout sizes but different encoded data lengths


The VB.NET Postnet barcode creating technology has been used by 1000+ developers since 2004


Support drawing and printing other common 1d & 2d barcodes on source document image file using VB.NET code


Output barcode image to any designed route in your VB.NET project




VB Code for Customizing POSTNET Barcode Generation



You can easily generator POSTNET barcode and save it  to image files/object using this VB.NET barcode generator control. The following steps will show how to create a POSTNET type barcode encoding numeric data text "01234" into the image object with XImage.Barcode.Creator.


Add References


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XImage.BarcodeCreator.dll


  System.Drawing.dll


Using Namespaces


  using System.Drawing;


  using RasterEdge.XImage.BarcodeCreator;


Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:

       

       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.

       

       If using x86, the platform target should be x86.



Please copy the sample code as follow to generator a POSTNET barcode.




'create a barcode
Dim barcode As Linear = New Linear()
'select barcode type
barcode.Type = BarcodeType.POSTNET
'set barcode data
barcode.Data = "01234";

barcode.X = 1.0F;'set x
barcode.Y = 60.0F;'set y
'set resolution
barcode.Resolution = 96
'set rotation
barcode.Rotate = Rotate.Rotate0
barcode.BarcodeWidth = 200
barcode.BarcodeHeight = 200
barcode.AutoResize = true

'convert barcode to a bitmap and save it to image file
'Dim bmp As Bitmap = barcode.ToImage()
'bmp.Save("C:\\barcode.bmp")





VB Image - Create Postnet Barcode on Image Files



Using this VB.NET Postnet barcode generator library, you can generate & draw Postnet barcode on png, gif, jpeg and bmp image files. Besides, you can generate Postnet barcode at the specified location of source file.




Dim image As REImage  = New REImage("C:\\Sample.png")
barcode.DrawBarcode(image, 150F, 150F)
image.Save(ImageType.PNG, "C:\\Sample_Barcode.png")





VB Image - Create Postnet on Document Files



If you want to generate Postnet barcode on a single-page or multi-page document files in VB.NET application, like PDF, Word, Excel, PowerPoint and TIFF, this Postnet Barcode Creator Add-on of RasterEdge DocImage SDK for .NET is quite suitable.



Postnet Barcode Generation in PDF File



Add References(Extra)


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XDoc.PDF.dll


Using Namespace(Extra)


  RasterEdge.XDoc.PDF;


  RasterEdge.Imaging.Basic;


  RasterEdge.Imaging.Raster.Core;



Dim  docx As PDFDocument = New PDFDocument("C:\\Sample.pdf")
Dim  page As PDFPage = docx.GetPage(0)
Dim  image As Bitmap = barcode.ToImage() 'Define on the above code
page.AddImage(image, New PointF(100F, 100F))
docx.Save("C:\\Sample_Barcode.pdf")




Postnet Barcode Drawing in Specific TIFF File Page



Add References(Extra)


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XDoc.TIFF.dll


Using Namespace(Extra)


  RasterEdge.XDoc.TIFF;


  RasterEdge.Imaging.Basic;


  RasterEdge.Imaging.Raster.Core;




Dim  docx As TIFFDocument = New TIFFDocument("C:\\Sample.tif")
Dim page As BasePage = docx.GetPage(0)
Dim  image As REImage = New REImage(barcode.ToImage())
page.AddImage(image, New PointF(100F, 100F))
docx.Save("C:\\Sample_Barcode.tif")




Postnet Barcode Creation in Word Document



Add References(Extra)


  RasterEdge.XDoc.Word.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.XDoc.Office.Inner..Office03.dll


Using Namespace(Extra)


  RasterEdge.XDoc.Word;


  RasterEdge.Imaging.Basic;


  RasterEdge.Imaging.Raster.Core;




Dim  docx As DOCXDocument = New DOCXDocument("C:\\Sample.docx")
Dim page As BasePage = docx.GetPage(0)
Dim  image As REImage = New REImage(barcode.ToImage())
page.AddImage(image, New PointF(100F, 100F))
docx.Save("C:\\Sample_Barcode.docx")




Postnet Barcode Drawing on Excel Sheet



Add References(Extra)


  RasterEdge.XDoc.Excel.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.XDoc.Office.Inner..Office03.dll


Using Namespace(Extra)


  RasterEdge.XDoc.Excel;


  RasterEdge.Imaging.Basic;


  RasterEdge.Imaging.Raster.Core;




Dim  docx As XLSXDocument = New XLSXDocument("C:\\Sample.xlsx")
Dim page As BasePage = docx.GetPage(0)
Dim  image As REImage = New REImage(barcode.ToImage())
page.AddImage(image, New PointF(100F, 100F))
docx.Save("C:\\Sample_Barcode.xlsx")




Postnet Barcode Writing on PowerPoint Slide



Add References(Extra)


  RasterEdge.XDoc.PowerPoint.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.XDoc.Office.Inner..Office03.dll


Using Namespace(Extra)


  RasterEdge.XDoc.PowerPoint;


  RasterEdge.Imaging.Basic;


  RasterEdge.Imaging.Raster.Core;




Dim  docx As PPTXDocument = New PPTXDocument("C:\\Sample.pptx")
Dim page As BasePage = docx.GetPage(0)
Dim  image As REImage = New REImage(barcode.ToImage())
page.AddImage(image, New PointF(100F, 100F))
docx.Save("C:\\Sample_Barcode.pptx")





VB Imaging - Entire VB Code to Create Postnet Barcode



Following VB code contains all above mentioned barcode generating parameters and you can use it to generate a customized Postnet barcode on a png image file.




'create REImage on which you want to draw the barcode
Dim reImage As REImage = New REImage("c:/Sample.png")

'create a barcode
Dim barcode As Linear  = New Linear()
'select barcode type
barcode.Type = BarcodeType.POSTNET
'set barcode data 
barcode.Data = "01234"

'POSTNET size settings
barcode.UOM = UnitOfMeasure.PIXEL
barcode.X = 2.0F
barcode.Y = 80F
barcode.BarcodeHeight = 120
barcode.BarcodeWidth = 120
barcode.BottomMargin = 20
barcode.TopMargin = 20
barcode.BottomMargin = 20
barcode.LeftMargin = 20
barcode.RightMargin = 20
barcode.AutoResize = false
barcode.BarAlignment = AlignmentHori.Center

'POSTNET unique settings
barcode.ShortTallRatio = 0.4F

'color related settings
barcode.BackColor = System.Drawing.Color.White
barcode.ForeColor = System.Drawing.Color.Black

'human-readable text related settings
barcode.ShowText = true
barcode.TextFont = New Font("Arial", 9f, FontStyle.Regular)
barcode.TextMargin = 6F
barcode.TextColor = System.Drawing.Color.Black

'other related settings
barcode.Resolution = 96
barcode.Rotate = Rotate.Rotate0

'draw barcode on REImage with location x and y
barcode.DrawBarcode(reImage, 0, 0)

reImage.Save(ImageType.PNG, @"c:/barcode.png")