QR Code

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.

  1. 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
    Registering 64-bit cruflbcs_x64.dll in Windows Command Prompt

    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
    Registering 32-bit cruflbcs.dll via administrator command prompt
  2. 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.

    Locating the BCSQRCodeEncodeCR function in Crystal Reports Visual Basic UFLs list
  3. 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".

    Creating a new Formula Field named BcsQRCode1 in Crystal Reports formula workshop

    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})

  4. 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)
    Creating multiple QR Code formula fields sequentially using index values in Crystal Reports

    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).

  5. 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.

    Placing sequential formula fields side-by-side inside a Crystal Reports text object
  6. 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.

    Selecting BcsQRCode as the font typeface in the Format Object window
  7. 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.

    Successful generation and preview of a QR Code in Crystal Reports

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.