How to create, print Code 128 in SSRS Reports in ASP.NET, WinForms application?

Create Code 128 Barcodes in SSRS Reports Projects Using .NET Control

Generate & print Code 128 barcodes in SQL Server Reporting Services 2005, 2008, 2008R2, 2012, 2014

  • Generate Code 128 barcodes in Microsoft SQL Server Reporting Services (SSRS) reports
  • Using Barcode Custom Report Item (CRI) for COde 128 creation.
  • Drag & drop Code 128 barcode report item to your Reporting Service report layout page.
  • Completely developed in C# managed code with digital signature.
  • Fully compatible with SQL Server Reporting Services 2005 and 2008 versions.
  • Reliable & mature Code 128 barcode generation for Reporting Service using .NET Barcode Generator.
This document provides a complete, step-by-step guide to generating Code 128 (a high-density linear barcode symbology) within SQL Server Reporting Service (SSRS) projects using C#.
  • This guide explains how to generate Code 128 barcodes natively inside SSRS Paginated Reports using SSRS barcode library.
  • All Code 128 configuration properties are managed in the Report Item Property panel during report design.
  • It covers Code 128 character encoding, code sets, function characters, check digits, HRI display, dimension settings, and GS1 encoding.
  • It ensures compatibility with SSRS rendering, deployment, and report server execution.


Deploy and Config Barcode Generator CRI into your Reporting Service projects

Top




Code 128 Barcode Generator Custom Report Item - Code 128 Barcode Parameters

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.

Set the value to BarcodeType.CODE128 or BarcodeType.CODE128A or BarcodeType.CODE128B or BarcodeType.CODE128C.

Code 128 type values are BarcodeType.CODE128 (7), BarcodeType.CODE128A (8), BarcodeType.CODE128B (9), BarcodeType.CODE128C (10).
Property: AddCheckSum
URL: ADD-CHECK-SUM
Type: bool
Default: false
AddCheckSum property is not applied here.
 
Code 128
Special
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: false
Auto resize the generated barcode image
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
Property: ForeColor
URL: FORE-COLOR
Type: Color
Default: black
Barcode image foreground color
 
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: 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
 
Image
Format
Property: Format
URL: FORMAT
Type: ImageFormat
Default: Png
Barcode image encoding type.
 
Methods
// 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()
 
In WebStream query string, please use int value for Enums, "true" and "false" for bool.


Code 128 Character Encoding in SSRS

Encoding Character Sets

Code 128 supports a full set of characters for enterprise SSRS reporting scenarios.

Supported character sets:
  • All 128 full ASCII characters defined in ISO/IEC 646.
  • Extended ASCII characters (128–255, ISO/IEC 8859-1 Latin 1) using FNC4.
  • Four non-data function characters.
  • Four code-set selection characters.
  • Three start characters.
  • One stop character.
All encoding behavior is controlled via settings in the SSRS Report Item Property panel.



Code 128 Code Sets (A, B, C)

Code 128 uses three optimized code sets to maximize data density in SSRS reports.
  • Code Set A: Supports uppercase letters, numbers, and control characters.
  • Code Set B: Supports full alphanumeric and lowercase text.
  • Code Set C: Supports compact numeric pairs (high-density number encoding).
Automatic and manual configuration:
  • Use CODE128 to let the library auto-select the best code set.
  • Manually force a set using CODE128A, CODE128B, or CODE128C.
  • All type settings are mirrored in SSRS Report Item Property.


Note: Incorrect manual code sets may cause invalid barcodes in published SSRS reports.


Code 128 Function Characters (FNC)

Function characters (FNC) enable specialized barcode behavior in SSRS supply chain and logistics reports.
  • FNC1: Used for GS1 / GS1-128 (logistics and supply chain SSRS reports).
  • FNC2: Used for message append operations.
  • FNC3: Used for scanner initialization commands.
  • FNC4: Used to extend character sets to ISO/IEC 8859-1.
The SSRS Barcode library automatically encodes function characters. No extra keyboard input is required in your SSRS expression or dataset field.


Code 128 Check Digit Calculation

Code 128 includes a mandatory Mod 103 check digit.
  • The check digit is auto-generated and cannot be disabled.
  • The AddCheckSum property does not apply to Code 128.
  • The SSRS Barcode library always computes and appends the check digit before the stop character.
  • The check digit is not visible in Human Readable Interpretation (HRI).


Note: Do not attempt to override check digits in SSRS Report Item Property; it will break barcode validity.


Code 128 Human Readable Interpretation (HRI) in SSRS

HRI is the readable text displayed with the Code 128 barcode.

To show HRI below the barcode:
  • Use default properties in SSRS Report Item Property.
To show HRI above the barcode:
  • Set TextMargin to a negative value.
  • Adjust margins to avoid overlapping the barcode symbol.



Code 128 Dimension & Size Settings

All dimension properties are configured in SSRS Report Item Property.

Configurable properties:
  • UOM (Unit of Measure): PIXEL, CM, or INCH.
  • X: Width of the narrow bar module.
  • Y: Height of the barcode module.
  • LeftMargin & RightMargin: Quiet zones (minimum 10X).



Note: Insufficient quiet zones will make barcodes unreadable after Report Deployment to the Web Portal.


GS1 Data Encoding in Code 128 (GS1-128)

Code 128 is fully compatible with the GS1 standard for SSRS supply chain reports.
  • To encode GS1 data, use GS1-128 / EAN-128 mode.
  • Enable FNC1 to mark the barcode as GS1-compliant.
  • Bind GS1-formatted strings from a Calculated Field in your SSRS dataset.
  • Configure related properties in the SSRS Report Item Property panel.


Summary

This document provides a complete workflow for generating Code 128 barcodes using C# within SQL Server Reporting Service .NET projects. Every configuration related to Code 128, including encoding, code sets, function characters, check digits, HRI appearance, dimensions, quiet zones, and GS1 support , is managed through the Report Item Property panel in report design.












Common Asked Questions

What is the barcode Code 128 text code?

Code 128 barcode is a high-density 1d barcode symbology, which encodes digits, letters, control characters, and full ASCII 128 characters. Using SQL Server Reporting Services barcode generator library, you can create, print, insert Code 128 barcodes in SSRS report table cells, preview the Code 128 barcodes in SSRS report viewer in .NET ASP.NET Core, Windows Forms projects.

What is Code 128 barcode maximum length?

There is no specific definition about Code 128 barcode maximum number of characters in Code 128 ISO 15417 standard.

However some Code 128 standards will provide the limits. GS1-128 has limits the maximum length of Code 128 data to 48 characters.

Using SQL Server Reporting Services Barcode library, you will encode and generate ISO standard Code 128 and application approved Code 128 barcodes, such as GS1-128 in SSRS reports in .NET web and Windows applications.

What is the check digit for code 128?

Code 128 barcode contains a last digit of mandatory check digit (checksum) character, which is based on module 103 (mod 103). Code 128 check digit will not be displayed in the Code 128 human readable text and will not be returned by the Code 128 barcode scanners. Using SQL Server Reporting Services barcode freeware, the generator software will automatically calculate the check character and insert into the Code 128 barcode in Visual Studio .NET SSRS reports ASP.NET Core, Windows Forms projects.

What is Code 128 barcode commonly used for?

Code 128 barcode is a common linear barcode type used in:
  • Food and non-food industries
  • Shipping and packing industry
  • Health, public sector and government bodies
Code 128 supports GS1 standards, which will be used in higher levels of packaging that are used in shipping and general distribution. You can easily create standard Code 128 barcodes in SSRS reports using Microsoft Visual Studio SQL Server Reporting Services Report Designer extension.

Is Code 128 barcode better than Code 39?

Both Code 128 and Code 39 are popular 1d barcode symbologies. Code 128 is more compact than Code 39, supporting more data to be encoded in a smaller space. SQL Server Reporting Services Barcode library allows C#/VB.NET developers to encoding and printing both Code 128 and Code 39 using Microsoft Visual Studio with the SSRS Report Designer extension.

How to scan, read Code 128 barcodes?

To scan, read and decode the Code 128 barcodes from SSRS reports, you can download and install OnBarcode free Code 128 barcode scanner software, or use barcode scanner device, or smart phone (iOS or Android) camera with 3rd party barcode apps installed.












































































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