Skip to main content
A newer version of this page is available. .

Bar Code

  • 13 minutes to read

This document provides general information on using bar codes in Snap applications, lists the supported bar code symbologies, and describes properties common to all bar codes as well as properties specific to bar codes of certain symbologies.

The document consists of the following sections.

Creating Bar Codes

To insert a bar code into a document, a special Snap field is provided that transforms a specified content to a selected bar code symbology.

To add a bar code to a report, click the Bar Code button in the General Tools: Insert toolbar.

snap-end-user-elements-bar-code0

This will insert a new bar code into the carriage position.

snap-end-user-elements-bar-code4

To transform an existing Snap field to a bar code, do the following.

  1. Select the field that you wish to transform.

    snap-end-user-elements-bar-code5

  2. Click Properties in the Data Tools: Field toolbar.

    In the invoked drop-down menu, expand the Content Type drop-down list and select the Bar Code item.

    snap-end-user-elements-bar-code1

You can use a bar code to display either static textual data or dynamic data obtained from a data source:

  • To provide static data to a bar code, specify its Data properties in the Properties menu.

    snap-end-user-elements-bar-code2

  • To bind a bar code to dynamic data, specify its Binding property in the Properties menu.

    snap-end-user-elements-bar-code3

    A bar code that does not have a parent Snap list cannot be bound to data, and you can only bind a bar code to the data source of its parent Snap list (i.e., the snap list in which the bar code resides). Data-bound bar codes ignore the Data property.

Common Bar Code Properties

You can customize a bar code’s data binding, symbology and other options via the Properties command from the Field tab of the main toolbar.

snap-end-user-elements-bar-code1

The following properties are common for all available bar code symbologies.

  • Binding - specifies a data field that provides the data to be encoded as a bar code. If this property is specified, the value of the Data property is ignored.
  • Symbology - determines the bar code type.
  • Data - specifies textual data to be encoded as a bar code. This property is ignored if a bar code is bound to a data field. If the content does not conform to the rules of a certain symbology (determined by the Symbology property), the control will display a warning, as illustrated in the image below.

    RD_Controls_BarCode_1

  • Alignment - determines the alignment of the bar code image within the control. To define text alignment, use the Text Alignment property.
  • Text Alignment - allows you to change the alignment of the control’s text. This option is also available in the Formatting Toolbar. To define the alignment of the bar code image, use the Alignment property.
  • Orientation - specifies one of four possible orientations (Normal, Upside Down, Rotate to the Left, and Rotate to the Right) for an image within the control.
  • Show Data - determines whether or not bar code text is shown.
  • Module - specifies the width of the narrowest bar or space in the bar code. Note that if the Module value is too low, the bar code output may become unreadable by a bar code scanner.
  • Auto-Module - when the check-box for this property is checked, the bar code image is stretched to fit the entire control’s width, ignoring the value of the Module property.

    The bar code quality can degrade when the report is exported to formats other than PDF. To ensure reliable bar code recognition, print the report directly from an application using the native printing methods. The Module and Auto-Module properties of a control should be used with care.

Supported Symbologies

Symbology defines the mapping between bar code data and the image generated. Most bar code symbologies have their own specific properties in addition to the properties listed in the previous section, as well as restrictions on the characters allowed in bar code data for proper bar code generation. The symbologies supported by the Bar Code control are listed in the following table.

Symbology

Description

Codabar

This is an old format that uses discrete, self-checking symbology, capable of encoding 16 different characters, plus an additional 4 start/stop characters.

Specific properties:

  • Start and Stop Symbols - specifies the first (start) and last (stop) symbols used to code the bar code structure.
  • Wide Narrow Ratio -specifies the density of bar code bars.

Code 11

This bar code, also known as “USD-8“, was developed as a high-density numerical-only symbology. The symbology is discrete, and is able to encode the numbers 0 through 9, the dash symbol (-), and start/stop characters.

Code 128

This is a popular high-density bar code that permits you to encode messages of arbitrary lengths using any character in the ASCII character set. The symbology includes a checksum digit for verification.

Specific property:

  • Character Set - specifies a set of symbols that can be encoded by the bar code. To allow the code data to contain any ASCII symbol, set this property to Auto Charset.

Code 39

This bar code, also known as “3-of-9 Code“ and “USD-3“, can encode uppercase letters (A through Z), digits (0 through 9) and several special characters (e.g., the $ sign).

Specific properties:

  • Calculate a Checksum - determines whether or not to calculate a checksum for the bar code.
  • Wide Narrow Ratio - specifies the density of bar code bars (should be in the range of 2.2 - 3).

Code 39 Extended

This bar code, also known as “Full ASCII Code 39“, is an extension of Code 39. It is capable of encoding all 128 ASCII characters.

Specific properties:

  • Calculate a Checksum - determines whether or not to calculate a checksum for the bar code.
  • Wide Narrow Ratio - specifies the density of bar code bars (should be in a range of 2.2 - 3).

Code 93

This alphanumeric and variable-length bar code was designed to supplement and improve Code 39 by providing higher reliability and density.

Specific property:

  • Calculate a Checksum - determines whether or not to calculate a checksum for the bar code.

Code 93 Extended

This bar code supports encoding all 128 ASCII characters by using the Full ASCII Mode of Code 93. This bar code uses the ($), (/), (%), and (+) symbols as “shift” characters.

Specific property:

  • Calculate a Checksum - determines whether or not to calculate a checksum for the bar code.

Code MSI

This is a low-density, numerical-only bar code, also known as “Modified Plessey“.

Specific property:

  • MSI Checksum - specifies the type of the checksum calculated for a bar code (can be set to None, Modulo 10 and Double Modulo 10).

Data Matrix ECC200

This is a two-dimensional matrix bar code consisting of black and while “cells” arranged in a square or rectangular pattern. The encoded information can be text or raw data.

Specific properties:

  • Compaction Mode - determines whether textual information or a byte array should be used as the bar code data.
  • Matrix Size - specifies the bar code matrix size.

Data Matrix GS1

This bar code uses a special start combination to differentiate its symbols from the Data Matrix ECC200 symbols.

Specific properties:

  • FNC 1 Functional Character - specifies the symbol (or set of symbols) in the bar code text that will be replaced with the FNC1 functional character when the bar code’s bars are drawn.
  • Human-Readable Text - specifies whether parentheses should be included in the bar code text.

UCC/EAN-128

The modern name of this bar code is “GS1-128“. It is based on the Code 128 standard and additionally specifies the Application Identifiers for data sections within the code. It includes “best before” dates, batch numbers, quantities, weights and other attributes.

Specific properties:

  • Character Set - specifies a set of symbols that can be encoded by the bar code. To allow the code data to contain any ASCII symbol, set this property to Auto Charset.
  • FNC 1 Functional Character - specifies the symbol (or set of symbols) in the bar code text that will be replaced with the FNC1 functional character when the bar code bars are drawn.
  • Human-Readable Text - specifies whether or not parentheses should be included into the text below the bar code for improved readability.

EAN 13

This bar code contains 13 digits, with no letters or other characters. The first two or three digits represent the country. The leading zero signifies the USA, and UPC-A coding. The last digit is the checksum digit. The control calculates it automatically, and it should not be present in the control’s text string.

For this reason, make sure that the text for this symbology contains no more than 12 digits. If fewer digits are supplied, the string is padded with zeros on the left.

EAN 8

This is a shortened version of the EAN-13 code. It includes a two or three digit country code, four or five data digits (depending on the length of the country code), and a checksum digit. The control calculates the checksum digit automatically and it should not be present in the control’s text string.

For this reason, make sure that the text for this symbology contains no more than 7 digits. If fewer digits are supplied, the string is padded with zeros on the left.

GS1 Data Bar

This bar code is based on a family of symbols often used in the GS1 DataBar Coupon (coupon codes commonly used in retail). These bar codes can encode up to 14 digits, which makes them suitable for GTIN 8, 12, 13 and 14.

GS1 DataBar Expanded and GS1 DataBar Expanded Stacked can encode up to 74 numeric or 41 alphanumeric characters, and provide the capability to utilize all GS1 Application Identifiers (e.g., expiration date, batch and serial number). These bar codes are often used in manufacturer coupons.

Specific properties:

  • FNC 1 Functional Character - specifies the symbol (or set of symbols) in the bar code text that will be replaced with the FNC1 functional character when the bar code’s bars are drawn.
  • Segments In Row - specifies the number of data segments per row in the Expanded Stacked type of a GS1 DataBar bar code.
  • Type - specifies the type of a GS1 DataBar bar code.

Industrial 2-of-5

This is a numerical, low-density bar code that is based on the 2-of-5 symbology (non-interleaved).

Specific properties:

  • Calculate a Checksum - determines whether or not to calculate a checksum for the bar code.
  • Wide Narrow Ratio - specifies the density of bar code bars (should be greater than or equal to 2.5).

Intelligent Mail

This is a 65-bar code (often referred to as “IM“) for use on mail in the United States. It is a height-modulated bar code, encoding up to 31 decimal digits of mail-piece data into 65 vertical bars.

Interleaved 2-of-5

This is a higher-density numerical bar code that is based on the 2-of-5 symbology.

Specific properties:

  • Calculate a Checksum - determines whether or not to calculate a checksum for the bar code.
  • Wide Narrow Ratio - specifies the density of bar code bars (should be greater than or equal to 2.5).

ITF-14

This bar code, also known as “UPC Shipping Container Symbol“, is used to mark packaging materials that contain products labeled with a UPC or EAN product identification number.

This bar code provides a GS1 implementation of an Interleaved 2-of-5 symbology for encoding a Global Trade Item Number (an identifier for trade items developed by GS1). This bar code always uses a total of 14 digits.

Specific properties:

  • Wide Narrow Ratio - specifies the density of bar code bars.
  • Calculate a Checksum - determines whether or not to calculate a checksum for the bar code.

Matrix 2-of-5

A numerical-only variant of non-interleaved 2-of-5 bar code.

Specific properties:

  • Calculate a Checksum - determines whether or not to calculate a checksum for the bar code.
  • Wide Narrow Ratio - specifies the density of bar code bars (should be greater than or equal to 2.5).

PDF 417

Portable Data File is a popular bar code that can also be used to generate postage accepted by the United States Postal Service. It consists of a variable number of rows, each of which looks similar to a small linear bar code.

Specific properties:

  • Columns - specifies the number of bar code columns, which allows you to control the logical width of the bar code.
  • Compaction Mode - determines whether textual information or a byte array should be used as bar code data.
  • Error Correction Level - specifies the amount of redundancy built into the bar code’s coding, to compensate for calculation errors.
  • Rows - specifies the number of bar code rows, which allows you to control the logical height of the bar code.
  • Truncate Symbol - specifies whether or not the special end-symbol should be appended to the bar code.
  • Y to X Ratio - specifies the height-to-width ratio of a logical unit’s graphical representation.

PostNet

This bar code is used by the United States Postal Service to assist in directing mail. The code usually contains the zip-code and delivery point number. Unlike most other bar codes, PostNet actually encodes data in the height of the bars.

QR Code

Quick Response is a popular two-dimensional matrix bar code that consists of black modules arranged in a square pattern on a white background.

Specific properties:

  • Compaction Mode - determines whether textual information or a byte array should be used as the bar code data.
  • Error Correction Level - specifies the amount of redundancy built into the bar code’s coding, to compensate for calculation errors.
  • Version - determines the bar code’s size.

UPC-A

This bar code contains 12 digits, with no letters or other characters. The first digit is the prefix signifying the product type. The last digit is the “check digit”. The check digit is calculated using the first eleven figures when the bar code is constructed.

For this reason, make sure that the UPC-A text contains no more than 11 digits. If there are fewer digits, the string is padded with zeros on the left.

UPC-E0

This is a compact variation of UPC-A bar code that eliminates “extra” zeros. The first digit is always zero; the last digit is a checksum digit of the original UPC-A code.

Not every UPC-A code can be transformed to UPC-E0. For example, the control’s text string “4210000526“ is displayed by UPC-E0 bar code as “04252614“ and represents the “042100005264“ UPC-A code (check digit included).

UPC-E1

This is a compact variation of UPC-A bar code that eliminates “extra” zeros. The first digit is always 1, and the last digit is a checksum digit of the original UPC-A code.

Not every UPC-A code can be transformed into UPC-E1. For example, the control’s text string “4210000526“ is displayed by UPC-E1 symbology as “14252611“ and represents the “142100005261“ UPC-A code (check digit included).

UPC Supplemental-2

This is a supplemental two-digit bar code.

The bar code’s text must contain two digits.

UPC Supplemental-5

This is a supplemental five-digit bar code that is typically used for printing the suggested retail price of a book.

The bar code’s text must contain five digits.