Barcode Font Encoder Formulas for Crystal Reports

  • Crystal Reports Barcode Font Formula TutorialEasily create barcodes in Crystal Reports using fonts without installing UFLs* or DLLs.
  • Embeds the font encoder as a formula that is part of the .rpt report file, which stays embedded in the report when it is distributed.
  • Compatibility with Crystal 9 and up.
  • Complete source code included.
  • Supports generation of Code 128, GS1-128, Code 39, DataBar, Interleaved 2 of 5, UPC, EAN, USPS IMb, Data Matrix ECC200, DotCode, MaxiCode, QR-Code, PDF417, and others.
  • Royalty-free.


Font Formula Overview

IDAutomation's Font Encoder Formulas for Crystal Reports are saved as part of the report file (.rpt) and do not have any external dependencies (with the exception of the required barcode font). When distributing Crystal Reports, IDAutomation suggests using this method.

Crystal Font Formulas are currently supplied with the following 1D font packages:

Crystal 9 and up Font Formulas are currently supplied with the following 2D font packages:

* Due to limitations within Crystal Reports formulas, USPS Intelligent Mail IMb requires the installation of the associated UFL (dated 2014 or later) to perform a portion of complex calculations required for proper barcode generation. Installation of this UFL is automatic when running the installer for the associated font product. In addition, a silent installer is provided with all developer licenses to easily install the UFL when distributing reports.

Font Formula Tutorial

Each formula that is to be used with the font is supplied in the purchased barcode font package. The font formulas are included in the Crystal Reports Example Report and must be copied out of the example report into any new reports. Be sure to have the barcode font installed first so that the barcode will appear in the report after adding the formulas.

  1. This Crystal Report Barcode 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.
  3. Open the Crystal Reports Formulas report from the icon in the program group or from the "integration" or the "Crystal Reports Formulas" folder within the product ZIP file.

    The "Crystal Reports Formulas" folder of the product ZIP file.

  4. Choose View - Design to switch to design mode.
  5. Select the desired formula field and choose Edit - Copy. If the formula copied also contains a separate text field below the barcode, and the human-readable interpretation is desired, both formulas should be copied to the destination report.

    This formula also contains a separate text field below the barcode.

    Note: The barcode may not appear in the formula field as shown above, if the font for the formula it is intended for is not installed.
  6. Open the destination report in design mode and choose Edit - Paste to paste the formula object where it is needed.
  7. Highlight the object and choose Edit - Edit Formula.

    Edit barcode object formula
  8. If more than one barcode will be on the same report it is necessary to rename the formula. Right-click on the formula name (in the formula workshop) and choose rename. Add a descriptive name to the end, for example: IDAutomation_C128_ClientData.
  9. Modify the "DataToEncode =" line of the formula to equal the data that is to be encoded in the barcode. If a separate text field was also copied, the same changes should also be made to that formula.

    Connect to datasource

    If an error such as "A string is required" appears, the data will need to be converted to a string with a crystal function such as cStr. For example: DataToEncode = cStr( {Table.Field},0 )
  10. Run the report to verify barcodes are being properly created. Ensure the formula field object has been sized properly to contain the entire barcode width. If the width of the barcode is larger than the object, the result will be a truncated barcode that will not scan.
  11. When the Preview tab (or File - Print Preview) is selected, barcodes should be seen in the report. Print one page of the report and test with a barcode scanner. If a scanner is needed, IDAutomation suggests the IDAutomation USB Barcode Scanner, which scans all popular linear, GS1 DataBar and PDF417 barcodes.

    Barcodes in The Report Preview

    When 2D Data Matrix, QR Code, Aztec or Postal and Intelligent Mail IMb symbols need to be verified, IDAutomation suggests the 2D USB Barcode Scanner with PQA.
  12. It is also possible to combine multiple fields and place functions in a single barcode when using the Code 128 Auto formula in a report. For example, the following formula combines two fields in a single barcode and places a tab function between them:
    DataToEncode =({Table1.DataField1} & CHR(9) & {Table1.UPC})
    The following formula places a return function after the barcode:
    DataToEncode = ({Table1.DataField1} & CHR(13))
    Use CHR(9) for tab and CHR(13) for a return.

Creating Report Custom Functions

For advanced barcode Crystal Report developers using version 9 or above, Report Custom Functions may be created from IDAutomation's formulas and placed into the Repository of Custom Functions. Follow the procedures provided in the Crystal Reports documentation to create the function in the formula workshop and paste the formula (obtained from IDAutomation Formulas for Crystal Reports) in the function. For example:

Function IDAutomationCode128 (DataToEncode as String) as String 
  <<>IDAutomationCode128 = PrintableString   
End Function

In the Crystal Report, call the function:

IDAutomationCode128 ( {Table1.DataField1} )

NOTE: At this time, IDAutomation's support department does not troubleshoot Report Custom Functions. Please consider attempting to reproduce the issue with the IDAutomation Formulas for Barcode Crystal Reports Tutorial to obtain support for a particular problem with the formulas. If there is a problem working with IDAutomation's barcode fonts, visit the Barcode Font Support page. For assistance with other Crystal reports issues, refer to Crystal Reports Support Site.

Technical Support

Free product support may be obtained by reviewing articles that are documented on the IDAutomation's Barcode Font Support page and 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 Priority Support and Upgrade Subscription is active. For assistance with other Crystal reports issues, refer to Crystal Reports Support Site.

Common Problems and Solutions:

Symbology Specific Tutorials: