SSRS Barcode Font Encoder Report Example

SSRS Barcode Font Encoder

  • Easily generate barcodes in SSRS using fonts without any dependencies.
  • The font encoder is a custom report code that stays embedded in the report when it is distributed.
  • Complete royalty-free source code is included.
  • Compatible with SSRS Report Builder 3 and Report Designer from Visual Studio 2008 R2 and up; both RDL and RDLC files.
  • Supports generation of Code 128, GS1-128, Code 39, DataBar, ITF, UPC, EAN, USPS IMb, Aztec, Data Matrix ECC200, GS1-DataMatrix, QR-Code, GS1-QRCode, PDF417, and others.
  • Included with all Developer Licenses to any of the IDAutomation Barcode Font Packages purchased after April 2021. To obtain this product for previous purchases, the Level 2 Support and Upgrade Subscription must be active or purchased if it is not active.

New Functionality in the 2022 Release:

  • UTF-8 and Unicode support for Aztec, Data Matrix, PDF417, and QR Code.
  • QR Code can convert and encode in Base64.
  • TLV (Tag-Length-Value) can be automatically calculated and encoded in Base64 with QR Code, commonly used for Zakat & KSA invoicing.
  • Image overlay in QR Code as Center Override, commonly used for the Swiss QR-Bill.

Installation | Tutorial

The files for the Native Generators are located in the "SSRS Font Encoder" folder of the developer-licensed zip file. RDL files are also included as an example, which should be referred to if problems are encountered with implementation.

  1. This SSRS barcode report tutorial uses Code 128 from the Code 128 Font Advantage Package.
  2. Purchase and install the appropriate barcode fonts by running the setup EXE file provided in the font package.
  3. Open the custom code section of the report:
    • Visual Studio .NET Report Designer users: The font encoder can only be installed into existing reports. Select File - New - Project. To activate the Report menu in the VS .NET IDE, click on the body of the report. Select Report - Report Properties - Code.
      Select Report - Report Properties - Code
    • Report builder users: Choose File - New - Report and open the report custom code. If the Report Properties dialog does not appear, click on the gray area of the report.
      Report custom code dialog
  4. The code area of the report should now appear:
    SSRS report custom code area
  5. Open the desired font encoder in a text editor, in this tutorial IDAutomation_SSRS_FontEncoder_Code128.txt is opened.
  6. Copy the contents of the file, Paste the code into the custom code area, and choose OK. This places a custom function in the report that formats data to the barcode font. View the top portion of the code, highlight the expression example formula (for example =Code.IDAutomation_SSRS_FontEncoder_Code128), and copy it to the clipboard. This is the expression that will be used to generate the barcode as mentioned in step 9. Save the report.
    The custom code area
  7. Add a Textbox where the barcode is needed or locate an existing text field and size it to be large enough to contain the barcode. If the Textbox is not large enough, the barcode will be very distorted or truncated. In order to produce the required quiet zone or the space around the barcode, it is recommended to choose the paragraph center options.
    Centering and sizing the barcode field
  8. Right-click on the Textbox and select Expression. This is where the custom code is executed and the resulting barcode will be placed within the Textbox. In design mode, the expression will appear as «Expr» .
    The SSRS Expression
  9. Set the expression to include the barcode generation formula:
    =Code.IDAutomation_SSRS_FontEncoder_Code128(Fields!HeroID.Value)
    replacing HeroID with the data field that needs to be encoded in the barcode and select needs to be encoded in the barcode and select OK. To obtain the formula for other barcode types, refer to the name of the associated .txt file. Refer to the Barcode Parameters section of this manual for information about encoding multiple fields, different barcode types, and appending static text to dynamic data.
    Setting the value for the expression
  10. Select the Textbox and set the font to the appropriate barcode font and point size. The "IDAutomationC128XS" font is selected in this example at 12 points.
    Selecting the barcode font for the field. 
  11. Run the report and verify the barcode is generated properly.

    Barcode Parameters and Other Information

    • Setting Barcode Properties: These may be set in the =code expression or in the custom code area. These parameters should only be set when necessary.
      • To set a parameter in the =code expression, place a comma after the field data and enter the value, for example:
        =Code.IDAutomation_SSRS_FontEncoder_Code128(Fields!HeroID.Value,0,True)
      • To set a default parameter in the custom code area, open the report custom code and locate the "Public Function" statement and change the desired default value.
        Font encoder parameters
    • Common Properties:
      DataToEncode
      ApplyTilde:
         
      QR Code in version 2022 or later of this product contains additional functionality when ApplyTilde is true:
         TLV Base64 - When the first character is | then automatically encode TLV values separated by | in Base64, for example:
            Example: "|SellerName|VNumber|DateTime|Total|VTotal"
         TLV - When the first two characters are ^| then automatically encode TLV values separated by |
         Base64 - When the first character is = encode the DataToEncode in Base64 excluding the =
    • Data Type Conversions: If the data in the field (HeroID in this case) is not stored as text it will need to be converted into a string before encoding, for example: Fields!HeroID.Value().ToString()
    • Encoding Multiple Fields: Multiple fields and static text may be combined and encoded in the same barcode in VBA code format. For example,
      =Code.IDAutomation_SSRS_Code128("IDA" & Chr(9) & Fields!HeroID.Value)
      Encodes the text IDA, a tab function, and the result of the HeroID field. The static text must appear in quotes and all information is concatenated with the ampersand (&) symbol.
    • Generating Multiple Barcode Types: If it is necessary to generate multiple barcode types on the same report, copy the function of the other barcode type needed into the code area (steps 3 and 4 above) under the function that already exists and update the expression, as in step 7-9 above. Be sure to select the appropriate barcode font for the expression being used.

Support

Free product support may be obtained by searching resolved Public Forum Threads. Priority phone, email, and forum support is also provided up to 30 days after purchase. Additional priority phone, email, and forum support may be obtained if the Level 2 Support and Upgrade Subscription is active. For assistance with other SSRS issues, refer to Microsoft Support for Business Site or the Microsoft SSRS TechNet Forum