Generate QR Code in Crystal Reports
How to generate a QR Code in Crystal Reports?
To generate a QR Code in Crystal Reports, create a new formula field using the BCSQRCodeEncodeCR function from the Barcodesoft UFL library. Pass your database fields as arguments, place the formula field on your design canvas, and apply the BcsQRCode font family.
-
Step 1: Determine SAP Crystal Reports Bitness and Register DLL
Determine the bitness of your SAP Crystal Reports version. SAP Crystal Reports 2008 through 2016 are 32-bit, while SAP Crystal Reports 2020 and 2025 are 64-bit.
For 64-bit Crystal Reports (2020 / 2025):
Run Command Prompt as Administrator and execute:
cd "C:\Program Files\Common Files\Barcodesoft\FontUtil"
%systemroot%\System32\regsvr32.exe cruflbcs_x64.dll
For 32-bit Crystal Reports (2008–2016):
Run Command Prompt as Administrator and execute:
cd "C:\Program Files (x86)\Common Files\Barcodesoft\FontUtil"
regsvr32.exe cruflbcs.dll
-
Step 2: Locate the Barcodesoft UFL Function
In Crystal Reports, navigate through the function explorer hierarchy: Functions List ⇒ Additional Functions ⇒ COM and .NET UFLs (u212com.dll) ⇒ Visual Basic UFLs. Double-click on the BCSQRCodeEncodeCR function.
-
Step 3: Create a New Formula Field
Right-click Formula Fields and choose New... from the context menu. Name your new field "BcsQRCode1", then click "Use Editor".
After the QR Code encoding process, even a short string might contain more code words than expected. Because Crystal Reports limits formula fields to 255 characters, you must split the encoded QR code into separate parts and concatenate them inside a Text Object before applying the font. Use the following function to check how many formula fields you will need:
BCSQRCodeFormulaNoForCR({Test.Data}) -
Step 4: Create Multiple Formula Fields
Create multiple formula fields as listed below if the returned value of
BCSQRCodeFormulaNoForCR({Test.Data})is larger than one. Then, place them sequentially inside the same Text Object.BCSQRCodeEncodeCR({Test.Data}, 1, 0)
BCSQRCodeEncodeCR({Test.Data}, 2, 0)
BCSQRCodeEncodeCR({Test.Data}, 3, 0)
Parameter Breakdown: The 1st parameter is the string to encode; the 2nd is the chunk index; the 3rd is the error correction level (1-4 represents L07, M15, Q25, and H30. Set to 0 for auto-selected default M15 error correction).
-
Step 5: Insert a Text Object in Your Report
Drag and drop all your created formula fields into this text object in sequence. You will see fallback hex codes in your report layout initially. Do not worry; this is normal because the barcode font has not yet been applied.
-
Step 6: Apply the BcsQRCode Font Typeface
Right-click the Text Object and select Format Object from the context menu. In the Font tab, choose "BcsQRCode" as your font family.
-
Step 7: Verify QR Code Generation
Click the OK button. The fallback characters will immediately render as a fully scannable QR Code in your report layout.
How to Generate GS1-Compliant QR Codes
If your project requires GS1-compliant formatting rather than standard text encoding, use the dedicated BCSQRCodeEncodeCRGS1 function across multiple split formulas:
BCSQRCodeEncodeCRGS1(str, 1, 0);
BCSQRCodeEncodeCRGS1(str, 2, 0);
BCSQRCodeEncodeCRGS1(str, 3, 0);
Parameter Specifications for GS1:
- 1st Parameter (str): The raw input data string. Ensure your format strictly groups elements using parentheses before and after each Application Identifier (AI)—for example,
(17)190508(90)50921. The library's background DLL handling will auto-inject necessary FNC1 delimiters. - 2nd Parameter: The sequential segment index of your target formula.
- 3rd Parameter: The desired error correction level configuration.