Code 128, ITF & Code 39 .NET Standard Barcode Generator Source Code Examples

Buy License Download Demo Support

Code128 Xamarin Example

Linear .NET Standard 2.0 Integration

This products supports Code-128, GS1-128, Code-39 (with MOD43 option) and ITF with the MOD10 option. The following code is provided to assist with implementation. Please refer to the .NET Barcode Generation and Xamarin examples provided in the download package for actual working app examples. 

Availability:

  • This product is sold as a separate component that primarily generates images and does not require the use of barcode fonts, however, basic barcode fonts are provided.
  • This product is also included as a font encoder in all Developer License Packages of the Linear Universal Barcode Font and the GS1-128 Barcode Font. Although the packages are different, the process of encoding the data and creating the barcodes are the same.

Generate text for the barcode font or Unicode Image on a label

C# Code Example:
Linear obj = new Linear();
Label lblBarcode = new Label();
(if you want to use the IDAutomation Uni XS font)
string textfont = obj.Code128(dataToEncode, applyTilde, OutputTypes.IDAUniXSFont);
lblBarcode.Font = new System.Drawing.Font("IDAutomation Uni XS", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
or (to use Courier New as Unicode Image)
string textfont = obj.Code128(dataToEncode, applyTilde, OutputTypes.IDAMonospaceFont);
lblBarcode.Font = new System.Drawing.Font("Courier New", 6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
lblBarcode.Text = textfont;
VB.NET Code Example: 
Dim obj As New Linear()
Dim lblBarcode as Label = new Label()
(if you want to use the IDAutomation Uni XS font)
Dim textfont as string = obj.Code128(dataToEncode, applyTilde, OutputTypes.IDAUniXSFont)
lblBarcode.Font = new System.Drawing.Font("IDAutomation Uni XS", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)
or (to use Courier New as Unicode Image)
Dim textfont as string = obj.Code128(dataToEncode, applyTilde, OutputTypes.IDAMonospaceFont)
lblBarcode.Font = new System.Drawing.Font("Courier New", 6, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)
lblBarcode.Text = textfont

Generate SVG or HTML output on a web browser control

C# Code Example:
Linear obj = new Linear();
string vectorimage = obj.Code128(dataToEncode, applyTilde, VectorTypes.VecSVG, "", QuietZone, ModuleSize, BarHeight);
or
string vectorimage = obj.Code128(dataToEncode, applyTilde, VectorTypes.VecHTML, "", QuietZone, ModuleSize, BarHeight);
WebBrowser webBrowser = new WebBrowser();
webBrowser.DocumentText = vectorimage;
VB.NET Code Example: 
Dim obj As New Linear()
Dim vectorimage as string = obj.Code128(dataToEncode, applyTilde, VectorTypes.VecSVG, "", QuietZone, ModuleSize, BarHeight)
or
string vectorimage = obj.Code128(dataToEncode, applyTilde, VectorTypes.VecHTML, "", QuietZone, ModuleSize, BarHeight)
Dim webBrowser as WebBrowser = new WebBrowser()
webBrowser.DocumentText = vectorimage
Generate SVG, EPS or the HTML output to save as a file
C# Code Example:
Linear obj = new Linear();
string vectorimage = obj.Code128(dataToEncode, applyTilde, VectorTypes.VecSVG, "", QuietZone, ModuleSize, BarHeight);
File.WriteAllText("Code128.SVG", vectorimage);
or
string vectorimage = obj.Code128(dataToEncode, applyTilde, VectorTypes.VecEPS, "", QuietZone, ModuleSize, BarHeight);
File.WriteAllText("Code128.EPS", vectorimage);
or
string vectorimage = obj.Code128(dataToEncode, applyTilde, ectorTypes.VecHTML, "", QuietZone, ModuleSize, BarHeight);
File.WriteAllText("Code128.HTML", vectorimage);
VB.NET Code Example: 
Dim obj As New Linear()
string vectorimage = obj.Code128(dataToEncode, applyTilde, VectorTypes.VecSVG, "", QuietZone, ModuleSize, BarHeight)
File.WriteAllText("Code128.SVG", vectorimage)
or
string vectorimage = obj.Code128(dataToEncode, applyTilde, VectorTypes.VecEPS, "", QuietZone, ModuleSize, BarHeight)
File.WriteAllText("Code128.EPS", vectorimage)
or
string vectorimage = obj.Code128(dataToEncode, applyTilde, VectorTypes.VecHTML, "", QuietZone, ModuleSize, BarHeight)
File.WriteAllText("Code128.HTML", vectorimage)

Generate BMP Image as byte array | BMP output on a picture box control 

C# Code Example:
C# Code Example
Linear obj = new Linear();
byte[] bmpstream = obj.Code128(dataToEncode, applyTilde, QuietZone, ModuleSize, BarHeight);
PictureBox picImage = new PictureBox();
picImage.AutoSize = true;
using (MemoryStream mStream = new MemoryStream(bmpstream))
{
Image img1 = Image.FromStream(mStream);
picImage.Image = img1;
}
VB.NET Code Example: 
Dim obj As New Linear()
Dim bmpstream() as Byte = obj.Code128(dataToEncode, applyTilde, QuietZone, ModuleSize, BarHeight)
Dim picImage as PictureBox = new PictureBox()
picImage.AutoSize = true
Dim mStream As MemoryStream = New MemoryStream(bmpstream)
Dim img1 As Image = Image.FromStream(mStream)
picImage.Image = img1

BMP output to save as a file

C# Code Example:
Linear obj = new Linear();
byte[] bmpstream = obj.Code128(dataToEncode, applyTilde, QuietZone, ModuleSize, BarHeight);
File.WriteAllBytes("Code128.BMP", bmpstream);
VB.NET Code Example: 
Dim obj As New Linear()
Dim bmpstream() as Byte = obj.Code128(dataToEncode, applyTilde, QuietZone, ModuleSize, BarHeight)
File.WriteAllBytes("Code128.BMP", bmpstream)

Common Parameters

  • DataToEncode - The data that is encoded in the barcode.
  • OutType – (only for font output) Indicates the type of encoded text output for the barcode font (IDAutomation font, Unicode Monospace).
  • VectorType – (only for vector output) Indicates the type of vector image for output encoded text (SVG, EPS or HTML).
  • ApplyTilde - Enables processing of tilde and parentheses characters for purposes of encoding ASCII functions & GS1 application identifiers. For example, ~202 encodes the FNC1 and ~009 encodes ASCII 9, the tab function.
  • QuietZone - Defines the size of a blank zone around the symbol.
  • ModuleSize - Defines the size of each module in pixels, applicable to images only. A multiplicative factor is added to avoid a strange blur effect that may occur with low values of SVG and HTML images.
  • BarHeight - Defines the height of each bar.

Support

Free product support may be obtained by reviewing the knowledgebase articles that are documented below and by searching the resolved public forum threads. Priority phone, email and forum support is provided up to 30 days after purchase. Additional priority phone, email and forum support may be obtained if the Priority Support and Upgrade Subscription is active.

NOTE: Portions of this product utilize IDAutomation USA Patent 7,637,436.