KA.Barcode Generator for .NET Suite allows developers to easily add USPS Intelligent Mail (Onecode) barcode generation functionality into .NET projects in Visual C#.NET class library, ASP.NET web applications, Crystal Reports, Reporting Services, etc.
This page provides details for USPS Intelligent Mail generation in C#.NET with demo code.
barcode generator in c# windows application codeproject,
barcode scanner c# code project,
asp.net mvc barcode reader,
how to print barcode in crystal report in c#.net,
how to read barcode in c# windows application,
visual basic .net barcode generator
Intelligent Mail is a linear barcode symbology also named USPS Intelligent Mail Barcode, OneCode 4CB, USPS 4CB, USPS OneCode Solution Barcode, USPS IM.
using KeepAutomation.Barcode.Bean;
//Create BarCode object in C#
BarCode postnet= new BarCode();
//Set barcode symbology type to Intelligent Mail
intelligentmail. Symbology = KeepAutomation.Barcode.Symbology. IntelligentMail;
//Set Intelligent Mail encoding valid data: numeric digits 0-9.
Length: 20, 25, 29 or 31 digits only.
intelligentmail.CodeToEncode = "12345678901234567890";
// Set Intelligent Mail image size
// Unit of measure: pixel, cm or inch.
intelligentmail.BarcodeUnit = BarcodeUnit.Pixel;
// Intelligent Mail image resolution in dpi
intelligentmail.DPI = 72;
// Intelligent Mail bar module width (X)
intelligentmail.X = 3;
// Intelligent Mail bar module height (Y)
intelligentmail.Y = 60;
// Intelligent Mail barcode image width
intelligentmail. BarCodeWidth=200;
// Image left margin size, minimum 10X.
intelligentmail.LeftMargin = 0;
// Image right margin size, minimum 10X.
intelligentmail.RightMargin = 0;
// Image top margin size, minimum10X.
intelligentmail.TopMargin = 0;
// Image bottom margin size, minimum 10X.
intelligentmail.BottomMargin = 0;
// Orientation: 90, 180 or 270 degrees.
intelligentmail.Orientation = Orientation.Degree0;
// Set Intelligent Mail human readable text style
// Display human readable text
intelligentmail.DisplayText = true;
intelligentmail.TextFont = new Font("Arial", 10f, FontStyle.Regular);
// Space between barcode and text
intelligentmail.TextMargin = 6;
// Generate Intelligent Mail barcodes in image GIF format
intelligentmail.generateBarcodeToImageFile("barcode-intelligentmail-csharp.gif");
// Create Intelligent Mail barcodes in Stream object
intelligentmail.generateBarcodeToStream(".NET System.IO.Stream Object");
// Draw & Print Intelligent Mail barcodes to Graphics object
intelligentmail.generateBarcodeToGraphics(".NET System.Drawing.Graphics Object");
// Generate Intelligent Mail barcodes & write to byte[]
byte[] barcodeInBytes = intelligentmail.generateBarcodeToByteArray();
// Generate Intelligent Mail barcodes & encode to System.Drawing.Bitmap object
Bitmap barcodeInBitmap = intelligentmail.generateBarcodeToBitmap();
Other image formats including PNG, BMP, TIFF and JPG are also available to suit your needs.