Complete Barcode Properties and API
for barcode generation


Generate, create linear, 2d barcode images in Visual Studio .NET application

Integration Guide & Tutorial to Generate Linear, 2D Barcodes using .NET Barcode Generator



OnBarcode C# Barcode library provide detailed options to create and customize QR Code, 2d and linear barcode symbologies. You can find all the barcode customization properties in the following C# classes.

  • OnBarcode.Barcode.Linear (for 1d barcode generation, such as Code 128, Code 39, UPC/EAN)
  • OnBarcode.Barcode.QRCode (for QR Code generation)
  • OnBarcode.Barcode.DataMatrix (for Data Matrix generation)
  • OnBarcode.Barcode.PDF417 (for PDF-417 generation)
  • OnBarcode.Barcode.MicroPDF417 (for Micro PDF-417 generation)
  • OnBarcode.Barcode.MicroQRCode (for Micro QR Code generation)




Complete List of Barcode Properties

Top


Category Properties Value Comments
Basic Property: Data
URL: DATA
Type: string
Default: "12345"
Barcode value to encode

Code 128 Valid Data Char Set:
  • all 128 ASCII characters (Char from 0 to 127)

Property: Type
URL: TYPE
Type: BarcodeType
Default: CODE128 (7)
Linear barcode symbology type.

Complete list of supported linear barcode formats:
    public enum BarcodeType
    {
        CODABAR,
        CODE11,
        CODE2OF5,
        INTERLEAVED25,
        CODE39,
        CODE39EX,
        CODE93,
        CODE128,
        CODE128A,
        CODE128B,
        CODE128C,
        EAN128,
        EAN8,
        EAN8_2,
        EAN8_5,
        EAN13,
        EAN13_2,
        EAN13_5,
        ISBN,
        ISBN_2,
        ISBN_5,
        ISSN,
        ISSN_2,
        ISSN_5,
        ITF14,
        IDENTCODE,
        LEITCODE,
        MSI,
        MSI10,
        MSI11,
        MSI1010,
        MSI1110,
        ONECODE,
        PLANET,
        POSTNET,
        RM4SCC,
        UPCA,
        UPCA_2,
        UPCA_5,
        UPCE,
        UPCE_2,
        UPCE_5,
        RSS14,
        RSS14STACKED,
        RSS14STACKEDOMNI,
        RSSLIMITED,
        RSSEXPANDED,
        RSSEXPANDEDSTACKED,
        COMPOSITE_CCA,
        COMPOSITE_CCB,
        COMPOSITE_CCC
    }




Data
Encoding
Related
Property: AddCheckSum
URL: ADD-CHECK-SUM
Type: bool
Default: false
For linear / 1D barcode formats only. The property is applicable for those formats whose check sum digit is optional.

Some linear barcode formats do not support this property. Please check your target barcode format document.
Property: ProcessTilde
URL: PROCESS-TILDE
Type: bool
Default: false
Set the ProcessTilde property to true, if you want use the tilde character "~" to specify special characters in the input data.

  • 1-byte character: ~0dd/~1dd/~2dd (character value from 000 ~ 255); ASCII character '~' is presented by ~126
    Strings from "~256" to "~299" are unused
  • 2-byte character (Unicode): ~6ddddd (character value from 00000 ~ 65535)
    Strings from "~665536" to "~699999" are unused




Barcode
Size
Related
Property: AutoResize
URL: AUTO-RESIZE
Type: bool
Default: true
Auto resize the generated barcode image.

If the property value is true, the generated barcode image width and height are decided by the property BarcodeWidth and BarcodeHeight.

And the property X and Y will be ignored. The barcode library will calculate and set the maximum value of X and Y.
Property: AutoResizeBarcodeText Type: bool
Default: true
The property will only be applicable when AutoResize is true.

If the property AutoResizeBarcodeText is true, then the barcode text label below barcode will be auto resized.
Property: AutoResizePaddingTransparent Type: bool
Default: true
The property will only be applicable when AutoResize is true.

If the property AutoResizePaddingTransparent is true, then the padding area around the barcode will be in transparent color.

If it is false, the padding area around the barcode will be the same color as BackColor
Property: IsMinQuietZoneApplied Type: bool
Default: true
Some barcode specification, (such as QR Code) requires minimum quiet zone. You can turn it off by setting the property to false.
Property: BarAlignment
URL: BAR-ALIGNMENT
Type: int
Default: 1 (center)
Barcode horizontal alignment inside the image. 0: left, 1: center, 2: right.
Property: UOM
URL: UOM
Type: UnitOfMeasure
Default: PIXEL (0)
Unit of meature for all size related settings in the library.

Valid values:
  • UnitOfMeasure.PIXEL (0)
  • UnitOfMeasure.CM (1)
  • UnitOfMeasure.INCH (2)
Property: X
URL: X
Type: float
Default: 1
Width of barcode bar module (narrow bar), default is 1 pixel
Property: Y
URL: Y
Type: float
Default: 60
Height of barcode bar module, default is 60 pixel
Property: BarcodeWidth
URL: BARCODE-WIDTH
Type: float
Default: 0
Barcode image width.

If barcodeWidth setting is smaller than the barcode required minimum width, the library will automatically reset to barcode minimum width.
Property: BarcodeHeight
URL: BARCODE-HEIGHT
Type: float
Default: 0
Barcode image height.

If barcodeHeight setting is smaller than the barcode required minimum height, the library will automatically reset to barcode minimum height.
Property: LeftMargin
URL: LEFT-MARGIN
Type: float
Default: 0
Barcode image left margin size.
Property: RightMargin
URL: RIGHT-MARGIN
Type: float
Default: 0
Barcode image right margin size.
Property: TopMargin
URL: TOP-MARGIN
Type: float
Default: 0
Barcode image top margin size.
Property: BottomMargin
URL: BOTTOM-MARGIN
Type: float
Default: 0
Barcode image bottom margin size.
Property: Resolution
URL: RESOLUTION
Type: int
Default: 72
Barcode image resolution in DPI (Dots per inch).
Property: Rotate
URL: ROTATE
Type: Rotate
Default: Rotate0 (0)
Valid values:

  • Rotate.Rotate0 (0)
  • Rotate.Rotate90 (1)
  • Rotate.Rotate180 (2)
  • Rotate.Rotate270 (3)




Barcode
Colors
Property: BackColor
URL: BACK-COLOR
Type: Color
Default: white
Barcode image background color.

To create barcode image with transparent background in C#, you can set the property BackColor to Color.Transparent.

C# sample code:
Linear barcode = new Linear();
barcode.BackColor = Color.Transparent;
Property: ForeColor
URL: FORE-COLOR
Type: Color
Default: black
Barcode image foreground color
Property: UseCMYKInEPS Type: bool
Default: false
For EPS file only.
If true, the barcode library will print barcode in EPS file with CMYK color converted from RGB color in BackColor and ForeColor.




Font
Style
Property: ShowText
URL: SHOW-TEXT
Type: bool
Default: true
If true, display barcode data text under the barcode, otherwise do not display.
Property: ShowCheckSumChar Type: bool
Default: true
If true, display the barcode checksum digit character in the barcode text.
Property: TextFont
URL: TEXT-FONT
Type: Font
Default:
new Font("Arial", 9f, FontStyle.Regular)
Barcode text font style.

In ASP.NET web streaming, using the url paramter in the following format:
&TEXT-FONT=Arial|9|regular
Property: TextMargin
URL: TEXT-MARGIN
Type: float
Default: 6
Space between barcode and barcode data text, default is 6 pixel
Property: TextColor
URL: TEXT-COLOR
Type: Color
Default: black
Barcode text color
Property: TopTextColor Type: Color
Default: Color.Black
For ISBN, ISSN only, the text color displayed on the top of the barcode.




Image
Format
Property: OutputFileFormat
URL: FILE-FORMAT
Type: FileFormat (enum)
Default: PNG
Barcode raster and vector image encoding type. Supporting formats:
For System.Drawing version: BMP/GIF/JPG/PNG/TIF/EPS/SVG
For SkiaSharp version: JPG/PNG/WEBP/EPS/SVG

You can draw and print barcode in Vector image file.

View details here: How to create barcode in vector image, SVG or EPS using C#?
 
In WebStream query string, please use int value for Enums, "true" and "false" for bool.




QR Code



Category Properties Value Comments
Basic Property: Data
URL: DATA
Type: string
Default: "QRCode"
Barcode value to encode

QRCode Valid Data Char Set:

  • numeric data (digits 0 - 9);
  • alphanumeric data (digits 0 - 9; upper case letters A -Z; nine other characters: space, $ % * + - . / : );
  • byte data (default: ISO/IEC 8859-1);
  • Kanji characters

 
QRCode
Special
Property: ProcessTilde
URL: PROCESS-TILDE
Type: bool
Default: true
Set the ProcessTilde property to true, if you want use the tilde character "~" to specify special characters in the input data. Default is true.
  • 1-byte character: ~0dd/~1dd/~2dd (character value from 000 ~ 255); ASCII character '~' is presented by ~126
    Strings from "~256" to "~299" are unused
  • 2-byte character (Unicode): ~6ddddd (character value from 00000 ~ 65535)
    Strings from "~665536" to "~699999" are unused
  • for GS1 AI Code:
    ~ai2: AI with 2 digits
    ~ai3: AI with 3 digits
    ~ai4: AI with 4 digits
    ~ai5: AI with 5 digits
    ~ai6: AI with 6 digits
    ~ai7: AI with 7 digits
  • ECI: ~7dddddd (valid value of dddddd from 000000 to 999999)
  • SJIS: from ~9ddddd (Shift JIS 0x8140 ~ 0x9FFC and 0xE040 ~ 0xEBBF)
Property: DataMode
URL: DATA-MODE
Type: QRCodeDataMode
Default: QRCodeDataMode.Auto (0)
  • QRCodeDataMode.Auto: It allows encoding all 256 possible 8-bit byte values. This includes all ASCII characters value from 0 to 127 inclusive and provides for international character set support
  • QRCodeDataMode.AlphaNumeric: It allows encoding alphanumeric data (digits 0 - 9; upper case letters A -Z; nine other characters: space, $ % * + - . / : ).
  • QRCodeDataMode.Byte: It allows encoding byte data (default: ISO/IEC 8859-1).
  • QRCodeDataMode.Numeric: It allows encoding numeric data (digits 0 - 9).
  • QRCodeDataMode.Kanji: It allows encoding Kanji characters.
Property: ECL
URL: ECL
Type: QRCodeECL
Default: QRCodeECL.L (0)
QRCode Error Correction Level. Default is QRCodeECL.L (0).
  • QRCodeECL.L (0)
  • QRCodeECL.M (1)
  • QRCodeECL.Q (2)
  • QRCodeECL.H (3)
Property: FNC1
URL: FNC1
Type: FNC1

Default: FNC1.
FNC1_NONE (0)
To encode GS1 compatible QR-Code barcode, you need set FNC1 value to FNC1.FNC1_1ST_POS (1).
Property: StructuredAppend
URL: STRUCTURED-APPEND
Type: bool
Default: false
Set StructuredAppend property to true, then Structured Append is enabled.
Property: SymbolCount
URL: SYMBOL-COUNT
Type: int
Default: 0
the number of total symbols which make the sequence.
Property: SymbolIndex
URL: SYMBOL-INDEX
Type: int
Default: 0
the position of current symbol in the secuence (Start with 0).
Property: Parity
URL: PARITY
Type: int
Default: 0
-
Property: Version
URL: VERSION
Type: QRCodeVersion
Default: QRCodeVersion.V1 (1).
Valid values are from V1 to V40.
Property: Logo Type: System.Drawing.Bitmap
Default: null
A Bitmap object containing logo image
Property: LogoActualSize Type: System.Drawing.SizeF Logo displayed area on QR Code




Data Matrix



Category Properties Value Comments
Basic Property: Data
URL: DATA
Type: string
Default: "DataMatrix"
Barcode value to encode

Data Matrix Valid Data Char Set:
  • ASCII values 0 - 127 in accordance with the US national version of ISO/IEC 646
    NOTE: This version consists of the G0 set of ISO/IEC 646 and the C0 set of ISO/IEC 6429 with values 28 - 31 modified to FS, GS, RS and US respectively.
  • ASCII values 128 - 255 in accordance with ISO 8859-1. These are referred to as extended ASCII.

 
Data Matrix
Special
Property: ProcessTilde
URL: PROCESS-TILDE
Type: bool
Default: true
Set the ProcessTilde property to true, if you want use the tilde character "~" to specify special characters in the input data. Default is true.
  • 1-byte character: ~0dd/~1dd/~2dd (character value from 000 ~ 255); ASCII character '~' is presented by ~126
    Strings from "~256" to "~299" are unused
  • 2-byte character (Unicode): ~6ddddd (character value from 00000 ~ 65535)
    Strings from "~665536" to "~699999" are unused
  • for GS1 AI Code:
    ~ai2: AI with 2 digits
    ~ai3: AI with 3 digits
    ~ai4: AI with 4 digits
    ~ai5: AI with 5 digits
    ~ai6: AI with 6 digits
    ~ai7: AI with 7 digits
  • ECI: ~7dddddd (valid value of dddddd from 000000 to 999999)
  • ~rp: Reader Programming (for ASCII mode and Auto mode only)
    This should be located at the beginning of the encoding data, e.g. data = "~rpABCD1234".
  • ~m5: 05 Macro (for ASCII mode and Auto mode only)
    This should be located at the beginning of the encoding data, e.g. data = "~m5ABCD1234".
  • ~m6: 06 Macro (for ASCII mode and Auto mode only)
    This should be located at the beginning of the encoding data, e.g. data = "~m6ABCD1234".
Property: DataMode
URL: DATA-MODE
Type: DataMatrixDataMode

Default: DataMatrixDataMode.
ASCII (1)
Data Matrix data encoding mode.

Valid values are:
  • DataMatrixDataMode.Auto (0): Barcode library will decide the best data mode for you.
  • DataMatrixDataMode.ASCII (1): it is used to encode data that mainly contains ASCII characters (0-127). This is the default encoding format by Barcode Library.
  • DataMatrixDataMode.C40 (2): it is used to encode data that mainly contains numeric and upper case characters.
  • DataMatrixDataMode.Text (3): it is used to encode data that mainly contains numeric and lower case characters.
  • DataMatrixDataMode.X12 (4):it is used to encode the standard ANSI X12 electronic data interchange characters.
  • DataMatrixDataMode.Edifact (5): it is used to encode 63 ASCII values (values from 32 to 94) plus an Unlatch character (binary 011111).
  • DataMatrixDataMode.Base256 (6): it is used to encode 8 bit values.
Property: FormatMode
URL: FORMAT-MODE
Type: DataMatrixFormatMode

Default: DataMatrixFormatMode.
Format_10X10 (0)
Default is DataMatrixFormatMode.Format_10X10 (0). Specifies the Data Matrix Format to use on that symbology. Valid values see enum DataMatrixFormatMode.Format_*X*;
Property: FNC1
URL: FNC1
Type: FNC1

Default: FNC1.
FNC1_NONE (0)
To encode GS1 compatible Data Matrix barcode, you need set FNC1 value to FNC1.FNC1_1ST_POS (1).
Property: StructuredAppend
URL: STRUCTURED-APPEND
Type: bool
Default: false
Set StructuredAppend property to true, then Structured Append is enabled.
Property: SymbolCount
URL: SYMBOLE-COUNT
Type: int
Default: 0
Set SymbolCount property to the number of total symbols which make the sequence.
Property: SymbolIndex
URL: SYMBOL-INDEX
Type: int
Default: 0
Set SymbolIndex property to the position of current symbol in the secuence (Start with 0).
Property: FileId
URL: FILE-ID
Type: int
Default: 0
Set FileId property to be identified to the same file.




PDF-417



Category Properties Value Comments
Basic Property: Data
URL: DATA
Type: string
Default: "PDF417"
Barcode value to encode

PDF-417 Valid Data Char Set:
  • Text Compaction mode permits all printable ASCII characters to be encoded, i.e. values 32 - 126 inclusive in accordance with ISO/IEC 646 (IRV), as well as selected control characters.
  • Byte Compaction mode permits all 256 possible 8-bit byte values to be encoded. This includes all ASCII characters value 0 to 127 inclusive and provides for international character set support.
  • Numeric Compaction mode permits efficient encoding of numeric data strings.
  • Up to 811,800 different character sets or data interpretations.
  • Various function codewords for control purposes.

 
PDF 417
Special
Property: ProcessTilde
URL: PROCESS-TILDE
Type: bool
Default: true
Set the ProcessTilde property to true, if you want use the tilde character "~" to specify special characters in the input data. Default is true.
  • 1-byte character: ~0dd/~1dd/~2dd (character value from 000 ~ 255); ASCII character '~' is presented by ~126
    Strings from "~256" to "~299" are unused
  • 2-byte character (Unicode): ~6ddddd (character value from 00000 ~ 65535)
    Strings from "~665536" to "~699999" are unused
  • Programming for reader initialisation: ~rp.
    This should be located at the beginning of the encoding data, e.g. data = "~rpABCD1234".
  • ECI: ~7dddddd (valid value of dddddd from 000000 to 999999)
Property: DataMode
URL: DATA-MODE
Type: PDF417DataMode
Default: PDF417DataMode.Text (1)
valid values:

  • PDF417DataMode.Auto (0)
  • PDF417DataMode.Text (1)
  • PDF417DataMode.Byte (2)
  • PDF417DataMode.Numeric (3)
  • PDF417DataMode.Customer (4)
Property: ECL
URL: ECL
Type: PDF417ECL
Default: PDF417ECL.Level_2 (2)
Error correction level, values are from PDF417ECL.Level_0 to PDF417ECL.Level_8, default is PDF417ECL.Level_2.
Property: RowCount
URL: ROW-COUNT
Type: int
Default: 3
The number of rows for PDF417. The value range is from 3 to 90. The default is 3.
Property: ColumnCount
URL: COLUMN-COUNT
Type: int
Default: 5
Number of columns. The value range is from 1 to 30. The default is 5. Increase this value, if your data size is large.
Property: Truncated
URL: TRUNCATED
Type: bool
Default: false
truncated PDF417 may be used where space considerations are a primary concern and symbol damage is unlikely.
Property: Macro
URL: MACRO
Type: bool
Default: false
Set isMacro property to true, then Macro PDF417 is enabled.
Property: MacroSegmentIndex
URL: MACRO-SEGMENT-INDEX
Type: int
Default: 0
the position of current symbol in the secuence (Start with 0).
Property: MacroSegmentCount
URL: MACRO-SEGMENT-COUNT
Type: int
Default: 0
the number of total symbols which make the sequence.
Property: MacroFileIndex
URL: MACRO-FILE-INDEX
Type: int
Default: 0
be identified to the same file
 
Barcode
Size
Related
Property: X
URL: X
Type: float
Default: 2
Barcode bar module width, default is 3 pixel
Property: XtoYRatio
URL: X-Y-RATIO
Type: float
Default: 0.3333333f
Bar width vs bar height ratio




UPC/EAN Barcodes Options (EAN-13, EAN-8, UPC-A, UPC-E)



Category Properties Value Comments
UPC/EAN
Barcode
Related
Property: UPCEANLeadDigitSpace Type: float
Default: 0f
The space between the first digit and the left side of the barcode
Property: UPCEANTrailDigitSpace Type: float
Default: 0f
The space between the last digit and the right side of the barcode
Property: UPCEANLeadTrailDigitSizeRatio Type: float
Default: 1f
The first and last digits size vs the other digits' size
Property: UPCENumber Type: int
Default: 0
For UPC-E barcode only, the UPC-E barcode number system.
Property: ShowQuietZoneIndicator Type: bool
Default: true
Whether display UPC/EAN quiet zone indicator mark or not.




Add-on Barcodes Options (EAN-13, EAN-8, UPC-A, UPC-E, ISBN, ISSN)



Category Properties Value Comments
Supplemental
Barcode
Related
Property: SupData
URL: SUP-DATA
Type: string
Default: ""
Set the supplement data to encode. Valid values are 2 or 5 digits
Property: SupHeight
URL: SUP-HEIGHT
Type: float
Default: 0.8f
This is a multiplicator of the height of the bar module; The default is 0.8 (80% of Y - bar module height).
Property: SupSpace
URL: SUP-SPACE
Type: float
Default: 15
The separation between the barcode and the supplement. Default is 15 pixel.




Barcode Exception



Category Properties Value Comments
Exception
Related
Property: ExceptionMode Type: ExceptionMode
Default: ExceptionMode.ShowErrorImage
When the barcode library cannot create a barcode successfully, the software will either generate an image with "Invalid Barcode Settings" message printed, or through Exception in the program.

You can find the details here: How to handle exception during barcode generation in C#?




List of Barcode methods

Top
// generate barcode and encode to image file
public void drawBarcode(string filename)

// generate barcode and paint on Graphics object
public void drawBarcode(Graphics graphics)

// generate barcode and paint on Bitmap object
public Bitmap drawBarcode()

// generate barcode and paint on Stream object
public void drawBarcode(Stream fileStream)

// generate barcode and paint on byte[] object
public byte[] drawBarcodeAsBytes()


// generate barcode and encode to EPS file
public void drawBarcode2EPS(string filename)

// generate barcode in a EPS file stream
public void drawBarcode2EPS(Stream fileStream)

// generate barcode in a EPS file in byte[] object
public byte[] drawBarcode2EPSAsBytes()


// generate barcode and encode to SVG file
public void drawBarcode2SVG(string filename)

// generate barcode in a SVG file stream
public void drawBarcode2SVG(Stream fileStream)

// generate barcode in a SVG file in byte[] object
public byte[] drawBarcode2SVGAsBytes()




































Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.