Crystal Reports Barcode How-Tos
PM > Install-Package BarcodeLib.Crystal.Reports


Home > .NET Crystal Reports Barcode > Crystal Reports Barcoding Guide > Crystal Reports Code 128 Barcode Generator Library

Code 128 Crystal Reports Barcode Generator DLL

Create and Print Code 128 Barcode Images for .NET Crystal Reports Application
  • Quickly install into .NET Crystal Reports Code 128 barcoding project with no need for any registration code or license key
  • Support Code 128 linear barcode generation on Crystal Report for Windows & ASP.NET web programs (design-time and runtime support)
  • Simply generate & print Code 128 barcode images on Crystal Reports using VB.NET or C# code
  • Support Code 128 barcode image generation in VS.NET class library & Console applications
  • Besides Code 128 barcode, .NET Crystal Reports barcoding library also supports other linear barcode images,
    like Codabar, Code 39, EAN-13, GS1-128, UPC, Interleaved 2 of 5
  • Provide affordable license price for this Crystal Reports Code 128 Barcode Generator Library
The Code 128 barcode generation component for Crystal Reports is a feature of the comprehensive .NET barcode library. It is capable of producing high quality Code 128 symbols as graphic images that can be exported to various file formats without image distortion.

This guide provides a detailed walkthrough of the process for generating Code 128 (a high density linear barcode symbology) in Crystal Reports for .NET within ASP.NET, Windows Forms, and WPF projects. It covers core implementation steps, character encoding, functional configurations, and dimension settings to ensure seamless integration with Crystal Reports components.





Code 128 Barcode Information

Code 128 is a very high-density linear barcode type that supports the encoding of alphanumeric data. It has been widely adopted to many applications where a relatively large amount of data must be encoded in a relatively small amount of space.

Code 128 Barcode Compatibility: BarcodeLib.com .NET Crystal Reports Barcoding Library is designed based on ISO / IEC 15417 Code 128 barcode specification. So, all generated Code 128 barcodes are complying with this specification.



How to Print Data Matrix in Crystal Reports?

We have prepared detailed step-by-step instructions how to create, print barcodes in Crystal Reports report in ASP.NET and Windows Forms application.

The above ASP.NET and WinForms demo application will create and print Code 128 barcodes in the report. In the rest of the page, we will explain how to customize printed Code 128 barcodes in report.

To further customize the Code 128 in report,
  • For ASP.NET web application, open file Default.aspx.cs in Visual Studio, go to method Page_Load
  • For WinForms application, open file Form1.cs in Visual Studio, go to method Form1_Load
Here is a sample report with Code 128 barcodes printed in web browser.



Code 128 Barcode Data Encoding in Crystal Reports

Code 128 Data Character Set

Code 128 barcodes (supported in Crystal Reports for .NET) support the following data characters:
  • All 128 Full ASCII characters defined in ISO/IEC 646
  • Extended ASCII characters (values 128 - 255 of ISO/IEC 8859 1) via Function Character FNC4
  • Four non data function characters (FNC1 - FNC4) for special operations
  • Four code set selection characters for switching between Code Sets A, B, and C
  • Three Start characters (one per code set) and one Stop character, which is mandatory for validation


Code 128 Data Code Sets in Crystal Reports

Code 128 barcodes incorporate three distinct code sets:
  • Code Set A: Includes uppercase letters, numbers, and control characters.
  • Code Set B: Includes lowercase letters, numbers, and standard symbols.
  • Code Set C: Optimized for numeric data, encoding two digits per character.
Key implementation notes for Crystal Reports:
  • The BarcodeLib library automatically selects the optimal code set when BarcodeType.CODE128 is used, which is ideal for dynamic data in Crystal Reports parameter fields.
    barcode.Type = BarcodeType.CODE128;
    

  • To manually specify a code set for fixed data (e.g., in Crystal Reports group headers or footers), set the Type property to one of the following:
    • BarcodeType.CODE128A (Code Set A)
    • BarcodeType.CODE128B (Code Set B)
    • BarcodeType.CODE128C (Code Set C)


Code 128 Function Characters in Crystal Reports

Function characters (FNC) in Code 128 enable special behavior in Crystal Reports barcode rendering:
  • FNC1: Used for GS1 system compliance, such as GS1 128 in supply chain reports.
  • FNC2: Enables message append, useful for multi part data in Crystal Reports group headers.
  • FNC3: Instructs scanners to reprogram or initialize; rarely used in standard reports.
  • FNC4: Encodes extended ASCII characters, which is critical for non English data in Crystal Reports.
Note: The barcode library automatically encodes FNC characters. They should not be manually entered into Crystal Reports parameter fields, formula fields, or C# code, as doing so will corrupt the barcode.


Code 128 Check Digit in Crystal Reports

Code 128 requires a mandatory check digit, calculated using the mod 103 algorithm.
  • The check digit is not visible in the human readable interpretation (HRI) and is not returned by scanners.
  • In Crystal Reports integration, the AddCheckSum property of the LinearCrystal class is not applicable for Code 128 barcodes. The library automatically calculates the check digit before the Stop character.


Code 128 Barcode Dimension Settings in Report

The Code 128 image size can be quickly customized within the report.
  1. Customize Code 128 barcode size in C# code.
    • UOM: Unit of measure (PIXEL, CM, or INCH), which should match the units used in the Crystal Reports report.
    • Set the target Code 128 barcode image width and height using the ImageWidth and ImageHeight properties.
    barcode.UOM = UnitOfMeasure.INCH;
    barcode.ImageWidth = 4;
    barcode.ImageHeight = 1.5f;
    
  2. Customize Barcode image item size in report designer in Visual Studio.

    Click the barcode item in the report designer, set the properties
    • Set XScaling to 4
    • Set YScaling to 1.5
Run the ASP.NET web application in Visual Studio, you can view the printed Code 128 barcode images with specified size in the report in web browser.





Code 128 Barcode Text Label Customization in Report

The human readable interpretation (HRI), the text displayed below or above the Code 128 barcode, is essential for readability in Crystal Reports. It must not encroach upon the barcode's quiet zone, which is mandatory for scannability.

By default, the Code 128 library prints the HRI (the Code 128 text label) below the barcode symbol.
  • Set property ResizeText to false to manually set the text font size
  • Use the TextFont property to specify the font name, style, and size.
  • Use the TextMargin property to customize the space between the barcode and the text label (HRI).
barcode.ResizeText = false;
barcode.TextFont = new Font("OCR-B", 38, FontStyle.Regular);
barcode.TextMargin = 0;


Do not print Code 128 barcode text label

You can choose to hide Code 128 barcode text label in the report.
barcode.ShowText = false;



Code 128 Barcode Colors

Using BarcodeLib Crystal Reports barcode library, you can easily print Code 128 barcodes with customized colors in the report.
  • Set property BarColor for Code 128 bar modules' color
  • Set property BackgroundColor for Code 128 space modules' color and background color
  • Set property TextFontColor for Code 128 text label color
barcode.BarColor = Color.Red;
barcode.BackgroundColor = Color.LightBlue;
barcode.TextFontColor = Color.Red;



Rotate Code 128 Barcode in Report

    • Set barcode property Rotate to apply the barcode rotation.
    barcode.UOM = UnitOfMeasure.INCH;
    barcode.ImageWidth = 4;
    barcode.ImageHeight = 1.5f;
    barcode.Rotate = RotateOrientation.BottomFacingRight;
    
  1. Modify the Code 128 barcode XScaling, YScaling values in report designer, if the Code 128 barcode is vertical printed.
Run the ASP.NET web form application, you will view the rotated Code 128 barcodes in the report in web browser.



Summary

This guide has presented a structured approach to generating and customizing Code 128 linear barcodes in Crystal Reports using the BarcodeLib .NET library.
  • Integration: Code 128 barcodes can be generated in C# or VB.NET and bound to Crystal Reports using ReportDocument, CrystalReportViewer, and .rpt templates. This approach is compatible with ASP.NET Web Forms, WinForms, and WPF (via WindowsFormsHost).
  • Data Encoding: The library supports all ASCII characters, extended ASCII via FNC4, and automatic or manual selection of Code Sets A, B, and C. Function characters enable GS1 compliance and extended functionality.
  • Layout and Appearance: Barcode dimensions, quiet zones, and human readable interpretation can be precisely configured to fit Crystal Reports headers, footers, and details sections, ensuring consistent print quality and scannability.
Linear & 2D Barcodes Supported by Crystal Reports Code 128 Generator DLL
Linear (1D) Barcodes:
Matrix(2D) Barcodes:
.NET Crystal Reports Barcode Generator Component - Generates Linear Barcodes on Crystal Reports: Codabar, Code 11, Code 2 of 5, Code 39, Code 93, Code 128, EAN-8, EAN-13, EAN 128/GS1 128, Interleaved 2 of 5, ITF14, MSI Plessey, Intelligent Mail (Onecode), PLANET, POSTNET, RM4SCC, UPC-A, UPC-E.
.NET Crystal Reports Barcode Generator Component - Generates 2D Barcodes on Crystal Reports: Data Matrix, PDF417, QR Code.