KA.Barcode Generator for .NET Suite
How to Generate Code 39 Image in C# Projects
Complete C# source code to generate Code 39 images in different image formats using Barcode for .NET
  • Easily draw, print linear Code 39, Code 39 Extension images in Microsoft Visual Studio .NET 2005, 2010, etc
  • Stream Code 39 bar codes in ASP.NET web page, paint Code 39 in WinForms, C# class & console applications
  • Draw QR Code .NET WinForms, Codabar Word, EAN-8 .NET WinForms, UPC-A VB.NET & other VB.NET Interleaved 2 of 5 in .NET IDEs
  • Generating, integrating 1D Code 39 in C#.NET programming and adjust I dimension
  • Print Code 39 barcodes in Png, Jpeg/Jpg, Gif, Tiff, Bmp image formats in Visual C# and save to local files
  • Support drawing Code 39 image with rotation in 0, 90, 180, or 270 degrees
  • Adjust Code 39 DPI to allow high-quality barcode image output for all printers
  • Customize font-style in the text and set DisplayStartStop to hide Code 39 start/stop character (*)
  • Draw and print .NET WinForms barcode, .NET barcode, ASP.NET barcode & barcode Excel in .NET IDEs
  • Simple to create Code 39 barcodes and customize image margins on all four sides
KA.Barcode Generator for .NET Suite is the best Code 39 barcoding component SDK available which allows you to easily create and display Code 39 images in .NET applications like ASP.NET web projects, Windows Forms with C#.NET, Visual Basic .NET class library. Flexible barcoding options are provided with C# demo for simple generation procedure.
Code 39 is a popular linear barcode which is also named 3 of 9 Barcode, ASNI/AIM Code 39, USD-3, USS Code 39, Code 3/9, Code 3 of 9, USD-3, Code 39 Extended. This page is on image setting for the generated Code 39 barcode images. If you want to learn how to encode valid data and generate Code 39 in proper size, simply follow the links below:
How to resize the bar width, image width of the Code 39? -- C#.NET Sample Code for 1D Code 39 Size Setting
How to encode alphanumeric data for Code 39? -- C#.NET Sample Code for 1D Code 39 Data Encoding
How to Generate, Specify Code 39 Barcode Images in C# Class

Install KA.Barcode Generator for .NET Suite into C#.NET Project

  1. 1.
  2. 2.
    Add Reference: Add "KeepAutomation.Barcode.Window.dll" to your C#.NET project reference.
Copy the following C#.NET example code onto your project to integrate a Code 39 barcode image in .NET.
using KeepAutomation.Barcode.Bean;

BarCode code39= new BarCode();
code39.Symbology = KeepAutomation.Barcode.Symbology.Code39;
code39.CodeToEncode = "CODE39";
code39.X =2;
code39.generateBarcodeToImageFile("C:/code39_csharp.png");


Code 39 I Dimension

I Dimension refers to the width of the intercharacter gap in a Code 39 barcode image. It is actually a multiple of X dimension, the width of the narrowest bar. For example, if you set X = 3, I = 2, then the intercharacter gap is actually 6. Default value is 1.
code39.I = 1;  

Code 39 Barcode Margins / Quiet Zones

The ISO/IEC 16388 Code 39 bar code symbology specification requires a minimum 10X (10 times the width of the module bar) margin, i.e. Quiet Zones, on the left and right sides of the barcode images. This 10X quiet zones are automatically added by KA.Barcode Generator for .NET Suite to ensure Code 39 image scannability. Default value is 0. If you want to add more value into the margin, simply copy the C# sample code below into your project.
code39.LeftMargin = 3;
code39.RightMargin = 3;
code39.TopMargin = 3;
code39.BottomMargin = 3;

Code 39 Image Formats

KA.Barcode Generator for .NET Suite supports printing and saving Code 39 barcodes in different image formats, including Png, Jpeg/Jpg, Gif, Tiff, Bmp, etc.
code39.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;

Code 39 Barcode Unit

KA.Barcode Generator for .NET Suite provides three units of measure for Code 39 image generation: Pixel, Cm and Inch. The default value is Pixel. Copy the demo code below to customize this parameter.
code39.BarcodeUnit = BarcodeUnit.Pixel;

Code 39 Image Resolution

KA.Barcode Generator for .NET Suite is designed to help you print high-quality barcode images in C#.NET. You can customize image resolution through DPI, which is short for Dots per Inch. 72 DPI is the default value for the generated Code 39 images.
code39.DPI = 72;   

Code 39 Image Orientation

In case you want to adjust Code 39 orientation, i.e. the barcode rotation angle, KA.Barcode Generator for .NET Suite provides four types of barcode orientations for you to choose from: 0 degree, 90 degrees, 180 degrees, and 270 degrees.
code39.Orientation = KeepAutomation.Barcode.Orientation .Degree90;