How to create, print QR Code in Crystal Reports in ASP.NET, WinForms application?

Create QR Code in Crystal Reports Projects Using .NET Control

Add high quality QR Code to .NET Crystal Report using barcode component SDK

  • Reliable and robust .NET component to generate QR Code in Crystal Report
  • Can be used in any .NET language environments such as C#, VB.NET, Managed C++, etc.
  • Easy to adjust QR Code value such as data mode, rotation, etc via C# and VB.NET
  • Xcopy deployment and free redistribution
  • Barcode generated completely conforms to international standard ISO/IEC 18004
  • Display QR Code as high quality Gif, Tiff, Png images or save as Bitmap, Stream, Graphic objects
  • Print QR Code in Crystal Report for .NET Windows Forms applications


Here we will learn how to generate, customize, print QR Codes in Crystal Reports in ASP.NET and Windows Forms applications.

Create QR Code in Crystal Report in ASP.NET Create QR Code in Crystal Report in Windows Forms


How to create, print QR Code in Crystal Reports in Visual Studio project?

  1. Download Crystal Reports QR Code Generator library
  2. Install Crystal Reports Barcode Generator dll file into Visual Studio .NET project
  3. Start to Create










Introduction of QR Code Crystal Reports Barcode Generator

Top
QR Code barcode generation control for Crystal Report is a professional and robust .NET component that integrates well into Visual Studio 2022/2019/2017/2015/2013 to generate QR Code dynamically in Crystal Report as lists.
Besides QR Code, .NET Barcode SDK for Crystal Reports also provides online detailed how-to and other linear and 2D barcode generator for Crystal Report:
  • Linear Barcodes: Code 39, Code 128, EAN-8, EAN-13, GS1 128, UPC-A, UPC-E, Interleaved 2 of 5, Identcode, ISBN, ISSN, ITF-14, Leitcode, MSI Plessey, OneCode, Planet, Postnet, RM4SCC, etc
  • 2D Barcodes: including QR Code, Data Matrix, PDF-417




How to Generate QR Code in .NET Crystal Reports report documents?

Top
This guide delivers a structured, step-by-step approach to creating and printing QR Code (Quick Response Code) images into Crystal Reports for .NET - supporting both ASP.NET and Windows Forms projects.

Leveraging a Barcode Generator for Crystal Reports C# library, you can embed QR Codes directly into .rpt file (Crystal Reports template files) for display in CrystalReportViewer (WinForms/ASP.NET viewer control) or exported report formats.


Preparation

We have prepared two step by step tutorials to create new ASP.NET/WinForms projects to print barcodes in .rpt reports in .NET application.


After you have built a new ASP.NET or Windows Forms project with the first barcode printed in the .rpt report, we will learn how to generate and customize QR Codes in Crystal Reports in the .NET application.


Print QR Codes in Crystal Reports report template

In the ASP.NET web or Windows Forms tutorial project, we have successfully created Code 128 barcode in Crystal Reports report template, and print Code 128 barcodes in the report viewer. Here we will print QR Codes in the Crystal Reports.

Follow these steps to generate a QR Code and prepare it for Crystal Reports integration:

  • Remove or comment out the existing Linear object generation code, in class file Form1.cs in WinForms project, or in class file Default.aspx.cs in ASP.NET project
  • Instantiate a new QRCode class object (the core object for QR Code configuration in the barcode library).
  • Assign the target report data to the Data property (this data will be encoded to QR Code, and printed in the Crystal Reports Details section or Report Header).
  • Invoke the drawBarcodeAsBytes() method to render and store the QR Code as a PNG image file in byte[] object (the standard format for Crystal Reports Picture controls in .rpt files).

//Linear linear = new Linear();
QRCode barcode = new QRCode();


After successfully generating a basic QR Code for Crystal Reports in your C# ASP.NET/WinForms project, explore these advanced customization areas to optimize QR Codes for your reporting workflow:
  • QR Code Data Encoding & Data Mode: Configure encoding rules to align with Crystal Reports Data Source types (e.g., ADO.NET DataSet for Push model data).
  • QR Code Dimension Customization: Adjust width/height to match the layout of Crystal Reports image controls (avoids distortion in exported/printed reports).
  • Advanced Text Encoding: Support ASCII non-printable characters (e.g., carriage returns) and Unicode text (multilingual content) for global Crystal Reports deployments.
  • GS1 Data Element Encoding: Integrate GS1-compliant data (e.g., product codes) into QR Codes for industry-specific Crystal Reports (e.g., supply chain reporting).




QR Code Text Encoding in Crystal Reports

Top

QR Code Encoding Character Sets for Crystal Reports

  • Numbers (digits 0-9)
  • ASCII characters (plain text)s
  • Unicode text - for multilingual reports (Arabic/Greek/Thai) in global deployments
  • Byte data (default: ISO/IEC 8859-1) - encoding byte array stored ADO.NET DataSet
  • Kanji characters (13-bit compression) - optimized for Japanese locale reports




QR Code Data Mode for Crystal Reports

The Crystal Reports for .NET Barcode library will analyze the QR Code encoding data and choose the right QR Code data modes for you. If you need manually customize the QR Code data mode encoding, you can use the following C# codes.

  • QRCodeDataMode.Auto (Default) The barcode library will choose the right combination of the data modes based on the QR Code encoding data.
  • QRCodeDataMode.Numeric Digits 0-9 only
  • QRCodeDataMode.AlphaNumeric 0-9, A-Z, special chars
  • QRCodeDataMode.Byte Byte data (ISO/IEC 8859-1)
  • QRCodeDataMode.Kanji Kanji characters (13-bit)
barcode.DataMode = QRCodeDataMode.Auto;




Maximum Data Length for Crystal Reports QR Codes

QR Code standards specifies forty sizes of QR Code barcode referred to as Version 1, Version 2 ... Version 40. You can learn more information here about QR Code Size and Version.

Version 40-L QR Codes (largest standard size) support these limits (avoid truncation in Crystal Reports):
  • Numeric data: 7,089 characters
  • Alphanumeric data: 4,296 characters
  • Byte data: 2,953 characters
  • Kanji data: 1,817 characters
Note: Exceeding these limits triggers QR Code encoding errors. Use Structured Append mode (covered later) for large text message.


C# codes to customize QR Code version in Crystal Reports .NET application.
barcode.Version = QRCodeVersion.V10;




Print QR Code with Diverse Text Formats in Crystal Reports

Top
QR Code is 2d barcode symbology, which support various text string formats defined by industry standars (such as GS1 Specification).

Here we will learn how to print QR Code with diverse text formats in Crystal Reports using C#.

  • ASCII characters (all 128 printing and non-printing chars)
  • Unicode text
  • GS1 message


Encode ASCII Non-Printing Characters

ASCII control characters (e.g., Carriage Return [CR]) require special encoding for structured data in Crystal Reports Formula field output.
  • ProcessTilde: Set to true (enables ~ as an escape character) Enable ProcessTilde (escape character support) in the barcode library.
  • Data: Non-printable chars are converted to ~ddd (3-digit ASCII value) format
QRCode barcode = new QRCode();
// encode non printable char '[CR]', between 'QR' and 'Code'
barcode.Data = "QR~013Code";
barcode.ProcessTilde = true;




Encode Unicode Text (Multilingual Reports)

QR Codes do not natively support Unicode (e.g., Thai/Arabic), but two methods enable multilingual Crystal Reports:
  • EncodeUnicodeText: Set to true to print QR Code with Unicode text encoding in Crystal Reports
  • Data: Enter Unicode text string
QRCode barcode = new QRCode();
barcode.Data = "Unicode text string here";
barcode.EncodeUnicodeText = true;




Generate GS1-Compliant QR Codes in Reports

GS1 QR Codes integrate industry-standard data (e.g., expiration dates, batch numbers) into Crystal Reports for supply chain/retail use cases.
  • FNC1: FNC1.FNC1_1ST_POS (enables GS1 formatting)
  • Data: AI codes (parentheses) + data (e.g., (17)050101(10)ABC123)
QRCode barcode = new QRCode();
barcode.FNC1 = FNC1.FNC1_1ST_POS;
barcode.Data = "(8101)06789900799";




Customizing QR Code Dimensions & Layout for Crystal Reports

Top

Adjust QR Code Size

Optimize QR Code dimensions for Crystal Reports image controls (avoid distortion in printed/exported reports). Use BarcodeWidth (QR Codes are square, so width defines both dimensions).

Add the following C# code to the Crystal Reports for .NET project.
  • Determine the QR Code printing size in your .rpt file (matches BarcodeWidth).
  • UOM to choose the preferred unit of measure inch or cm.
  • BarcodeWidth to specify the QR Code rendering side.
barcode.UOM = UnitOfMeasure.INCH;
barcode.BarcodeWidth = 3;




You can view more details here about QR Code size setting in Crystal Reports report template.




Configure QR Code Quiet Zones

Quiet zones (blank space) ensure scannability. Set margins on QR Code images in Crystal Reports.

Note: Insufficient quiet zones cause scan errors in printed reports. QR Code standard requires 10X (X is the QR Code module size) for quiet zone. Test physical prints before deployment.


barcode.UOM = UnitOfMeasure.INCH;
barcode.BarcodeWidth = 3;
barcode.LeftMargin = 0.2f;
barcode.RightMargin = 0.2f;
barcode.TopMargin = 0.2f;
barcode.BottomMargin = 0.2f;






Customizing QR Code Appearance for Crystal Reports

Top

Styling QR Code with logo image and colors

In Crystal Reports, you can easily print QR Code with logo image and customized colors to match brand guidelines.
  • ForeColor QR Code modules color. They usually are in black color.
  • BackColor QR Code background color. They usually are in white color.
  • Logo Specify the printed logo image in Bitmap object.
  • LogoActualSize Specify the logo image size in pixel.
  • ECL Choose QR Code error correction level.
barcode.ForeColor = Color.LightBlue;
barcode.BackColor = Color.White;
barcode.Logo = new System.Drawing.Bitmap("facebook_logo.png");
barcode.LogoActualSize = new System.Drawing.SizeF(240, 240);
barcode.ECL = QRCodeECL.Q;


QR Code with logo in Crystal Reports in ASP.NET web page QR Code with logo in Crystal Reports in Windows Forms




Advanced Image Options

  • High-Resolution QR Codes: Optimize for printed reports (critical for Crystal Reports Printing functionality).

    barcode.Resolution = 600;
    

  • Transparent Background. Seamless integration with Crystal Reports Details section backgrounds.

    barcode.BackColor = Color.Transparent;
    barcode.OutputFileFormat = FileFormat.PNG;
    




Advanced QR Code Options for ASP.NET/WinForms Crystal Reports

Top
Here are the advanced customization parameters for QR Code. We recommend using the preset values of the library. If you need to modify these parameters to meet specific requirements, please refer to the following C# code.


Error Correction Mode

Reed-Solomon error correction ensures QR Codes remain scannable (critical for printed reports). Configure ECL to match use cases:
  • QRCodeECL.L 7% (default)
  • QRCodeECL.M 15%
  • QRCodeECL.Q 25%
  • QRCodeECL.H 30%
barcode.ECL = QRCodeECL.L;




QR Code Version

QR Codes have 40 versions (sizes) to match data volume in Crystal Reports:

Note: Higher versions (V40) require larger PictureBox controls in Crystal Reports.


barcode.Version = QRCodeVersion.V10;




Structured Append Mode

Split large text message across up to 16 QR Codes (ideal for Summary field text exceeding single QR Code limits):

QRCode barcode = new QRCode();
barcode.Data = "https://www.onbarcode.com";
barcode.StructuredAppend = true;
// The data message will be stored in three QR Code barcodes
barcode.SymbolCount = 3;
// This symbol is the first one
barcode.SymbolIndex = 0; 




FNC1 First Position (GS1)

Enable FNC1.FNC1_1ST_POS for GS1-compliant Crystal Reports (supply chain/retail):

barcode.FNC1 = FNC1.FNC1_1ST_POS;
barcode.Data = "(8101)06789900799";












Common Asked Questions

What does QR stand for in code?

QR stands for "quick response", and QR Code is a 2-dimensional matrix barcode. The QR Code stores data information both horizontally and vertically. The QR Code is designed for high speed reading barcode. OnBarcode Crystal Reports QR Code Generator library supports QR Code generation in Visual Studio Crystal report designer, and preview QR Codes in report viewer in WinForms, ASP.NET Core projects.

What is the maximum data in a QR code?

A standard QR Code can store up to three kilobytes (KB) of data. A QR Code symbol with version 40-L can hold the following maximum data characters:
  • numeric data: 7,089 characters
  • alphanumeric data: 4,296 characters
  • byte data: 2,953 characters
  • Kanji data: 1,817 characters
In Crystal reports, if the encoding QR Code data size is over the maximum QR Code data capacity, the Crystal Reports barcode software will print an empty image with error messages printed in the report viewer.

What is the smallest I can make a QR code in Crystal reports?

The recommended smallest size of QR Code is 2 x 2 cm, and they will be scanned and read by cameras from smartphones (iOS or Android). If the generated QR Code is for QR Code scanners, the minimum size for a QR Code is 1 x 1 cm.

Using .NET Crystal Reports QR Code Generator library, you can create and customize the printed QR Code dimension size in Crystal report designer in Visual Studio .NET.

Does the color of a QR Code matter?

Choose whatever colors you want but always make sure the fore (bar) module and back (space) moduel colors have high contrast. We suggest at least 70% darker to ensure reliable camera scanning, and always scan and test your QR code using the camera in your smartphone.

You can customize the QR Code bar and space colors in Crystal report designer using Visual Studio .NET IDE.

How to create a QR Code for a picture?

To create a QR code from a photo or an image in Crystal reports
  • Convert the photo image raw data into byte array, and store in the database
  • Create, insert a QR Code barcode item in Crystal report designer
  • Set the QR Code data mode as byte
  • Print and output QR Code in the Crystal report. You can preview the report in report viewer.

What is the difference between a barcode and a QR Code?

Barcode is usually known as 1d or linear barcode symbology, which can store limited number of characters. QR Code or Quick Response Code, is a type of two-dimensional code, which will store characters horizontally and vertically, and a QR Code can hold more than 4,200 alphanumeric characters.

Using OnBarcode Crystal Reports for .NET Barcode Generator library, you can create, insert QR Code (standard, GS1, Micro, Macro versions) and other 20+ 2d, 1d barcodes such as Code 128, Data Matrix, EAN/UPC barcodes in Crystal report designer and view QR Code and barcodes in report viewer using Visual Studio .NET.




































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