C#. Code 39 Generator Size Setting Tutorial

sample source code to generate linear Code 39 images and adjust barcode size in C# .NET

  • Generate, create Code 39 as well as Code 39Ex barcodes in C#.NET applications
  • Completely written in C#.NET for .NET 2.0/3.0/4.0
  • Simple to modify the space of characters nearby in Code 39 and Code 39 Ex barcodes
  • Show or hide start character and stop character ?*?for Code 39 and Code 39 Ex
  • Display Code 39 check digit and human-readable text according to your needs
  • Minimum Code 39 knowledge with complete developer guide in C#.NET
  • Draw Code 39 barcodes compatible with the latest Code 39 specification - ISO / IEC 16388 (2nd edition 2007-05-15)
  • Mature, reliable Code 39 generating SDK in C#.NET Framework
  • Tutorial for Code 39 Image Setting in Visual C#.NET
  • Tutorial for Code 39 Data Encoding in Visual C#.NET

Code 39, also known as Alpha39, Code 3 of 9, Code 3/9, Type 39, USS Code 39, or USD-3, is the first alpha-numeric linear barcode symbology used world-wide.

How to generate, print barcode using .NET, Java sdk library control with example project source code free download:

Code 39 Structure

Code 39 Image Width Related Settings

W: the barcode width of Code 39. Please see BarCodeWidth.

X: the width of a narrow bar. X min = 1 pixel.Please see X.

Q: the width of the quiet zone. Q min = 10X.Please see Left & Right Margin.

I: the width of the inter-character gap; this is a multiple of X; I min = X. Please see I.

C: the number of encoded Code 39 data characters (including module 43 check character if used).

Code 39 Image Height Related Settings
H: the barcode height of Code 39. Please see BarCodeHeight.

Y: the height of a module bar. Please see Y.

N: the wide bar to narrow bar ratio. Please see N.

Top & Bottom Margin: the height of the top & bottom margin. Please see Top & Bottom Margin.

Text Margin: the space between image bar and text. Please see TextMargin.

Text Font: the font style of human-readable text. Please see TextFont.


Setting Code 39 Barcode Size in C#

C# Code 39 barcode provides a set of barcode size settings to specify you Code 39 barcodes. Please download C# barcode component and install, copy those following code to your Visual Studio:

Linear barcode = new Linear();

barcode.Type = BarcodeType.CODE39;

barcode.Data = "ONBARCODE";

Modify your Code 39 barcodes by setting those following properties:


UOM is short for Unit of Measure, which is the unit of measure for all size related settings in the library. C# Code 39 barcode provides 3 options: Pixel, Cm, and Inch. The default is Pixel.

barcode.UOM = UnitOfMeasure.PIXEL;


I is the space between 2 characters in code 39. It is a multiple of X. The default is 1.0f (float).

barcode.I = 1.5f;


N is the proportion of wide bar and the narrow. It ranges from 2.0 to 3.0. The default is 2.0f (float).

barcode.N = 2.5f;

Barcode Width & Height

BarcodeWidth is the Code 39 barcode image width. The default in C# Code 39 barcode is 0 (float).

BarcodeHeight is the Code 39 barcode image height. The default in C# Code 39 barcode is 0 (float).

barcode.BarcodeWidth = 0;

barcode.BarcodeHeight = 0;

Notice: if your setting is smaller than the barcode required minimum width and height, the library will automatically reset to barcode minimum width. Or you may enable AutoResize to automatically resize your Code 39 barcode image.

Barcode Margin

BarcodeMargin is the white zone around the Code 39 symbol. C# Code 39 barcode provides 4 options: Left Margin, Right Margin, Top Margin and Bottom Margin. The default of these four margins are 0 (float).

barcode.TopMargin = 3;

barcode.BottomMargin = 3;

barcode.LeftMargin = 1;

barcode.RightMargin = 1;

X & Y

X is the width of barcode bar module (narrow bar). The default in C# Code 39 barcode is 1 (float).

Y is the height of barcode bar module. The default in C# Code 39 barcode is 60 (float).

barcode.X = 2;

barcode.Y = 80;

Text Margin & Font

TextMargin is the space between barcode and barcode data text. The default in C# Code 39 barcode is 6 (float).

TextFont is the font style of human-readable text. The default in C# Code 39 barcode is new Font ("Arial", 9f, FontStyle.Regular).

barcode.TextMargin = 9;

barcode.TextFont = new Font("Arial", 20f, FontStyle.Regular);

OnBarcode is a market-leading provider of barcode imaging generator, reader controls and components for ASP.NET, Windows Forms, WPF, as well Java, Android, iOS (iPhone, iPad) across all major enterprise development platforms. We provides comprehensive tutorials and how-tos for various linear, 2d barcode information, such as C# in ASP.NET, C# .NET, C# Barcode Encoding, C# Barcode Image, VB.NET in ASP.NET, VB.NET Winforms, VB.NET Barcode Encoding. OnBarcode barcode products are supported by RasterEdge ASP.NET Document Viewer, which supports ASP.NET PDF Viewer, ASP.NET MVC Document Viewer, ASP.NET PDF Editor, MVC PDF Viewer. And provide high quality C# Convert PDF to Tiff, C# Convert PDF to Word, C# Convert PDF to HTML, C# Convert PDF to Jpeg images, and their easy and simple documents, like C# PDF SDK, C# extract text from PDF, C# Compress PDF, Print PDF in C# and C# extract image from PDF.
Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.