Visual C#.NET: Generate, Write Barcode on Document & Images

How to generate, write barcodes on document image using C#.NET
Yiigo provides .NET barcode reading support included in Yiigo.Image for .NET, which can be easily added to your document imaging applications with fully-automated, dynamic, and feature-packed barcode creating & writing functionalities. Find more barcode reading information on Yiigo.Imaging for .NET Barcode Generation Plugin.
Yiigo.Imaging for .NET Barcode Writing Plugin has those following functionalities:
  • Generate linear & postal barcode types
  • Generate QR Code, Data Matrix, PDF-417 barcodes
  • Create check character for linear barcodes if have one
  • Change barcode size, such as X, Y dimension, width and height, wide/narrow ratio
  • Provide error correction for 2D barcodes
  • Rotate barcode to any direction
  • Create supplemental barcode associated with this barcode
This document provides comprehensive Visual C#.NET samples for guiding developers to generate, write linear, postal & 2D barcodes on documents and images using Yiigo.Image for .NET. Find more barcode generating tutorials on VB.NET Barcode Generating, Web Imaging Viewer Barcode Writing Support and Generate Barcodes in .NET Winforms.
Generate Barcodes with C#.NET Sample Code

Requirements

Before generating barcodes in Visual C#.NET, make sure that you have installed.

Start to Create Barcodes

  • Open and run your Microsoft Visual Studio;
  • Choose either "Visual C# Projects" in "New Project" dialog box;
  • Choose "Windows Application" in the "Templates" List and name it "YiigoImagingBarcodeGenerateCsharp";
  • Right-click on the "References" folder, and select "Add Reference..." from the context menu in the "Solution Explorer" window;
  • In the "Add Reference" dialog box, select the ".NET" tab and browse to Yiigo.Imaging.Net.dll library and Yiigo.Imaging.Net.Barcode.Generate.dll ;
  • Add it to your Visual C# applications;
  • Call Yiigo .NET Image Namespace & Copy those following codes:
using System.IO;
using System.Drawing.Printing;
using Yiigo.Imaging;
using Yiigo.Imaging.Processing;
using Yiigo.Imaging.BarcodeGenerate;


// Create a barcode
YiigoBarCode barcode= new YiigoBarCode();
barcode.Symbology = Symbology.Code128;
barcode.CodeToEncode = "978123456789";
barcode.ChecksumEnabled = true;
barcode.DisplayChecksum = true;
barcode.BarcodeUnit = BarcodeUnit.Pixel;
barcode.DPI = 72;
barcode.X = 3;
barcode.Y = 60;
barcode.LeftMargin = 0;
barcode.RightMargin = 0;
barcode.TopMargin = 0;
barcode.BottomMargin = 0;
Orientation = Orientation.Degree180;
barcode.DisplayText = true;
barcode.TextFont = new Font ("Arial", 10f, FontStyle. Regular);
barcode.TextMargin = 6;
barcode.ImageFormat = ImageFormat.Png;


// Render a Given String
public void CheckCode128String(string s)
{
BarcodeGenerator bc = new BarcodeGenerator(BarcodeStyle.Code128);
if (!bc.Validate(s, false))
{
Console.WriteLine("Invalid barcode string: " + s);
}
else
{
Console.WriteLine("Barcode string accepted.");
}
}
Products
Other Plugins
Image Viewer CoreBarcode PluginPDF Read & WriteTesseract OCR PluginForm Processing PluginJBIG2 CodecJPEG2000 CodecISIS ScannerTwain ScannerDICOM ReaderCAD Scanner