
Making Barcode in Crystal Reports
Our User Function Library (the UFL) allows to use StrokeScribe barcode generator in Crystal Reports.
How to proceed
- Download and install the barcode generator
- Download and install the UFL DLL - V1.4.0.0
- The current UFL release requires the barcode generator version =>5.2.31.
The Crystal Reports UFL is free of charge, but you'll need to purchase a license for the barcode generator after testing the demo version.
How to create a Crystal report with a barcode
1. From the Crystal Reports designer menu, select Insert->Picture.
1.2. Choose absolutely any picture file - it will be a barcode placeholder for the first time.
Do not choose a large image for the placeholder. If you'll resize it, the barcode will be resized accordingly and may look too small.

2. Right-click the picture, select Format Graphic from the context menu:

3. Switch to the Picture tab, press the Graphic location formula button:

4. Paste the following code into formula editor (select Basic Syntax in the toolbox).
do
dim rc as number
rc = BarcodeSetLongProp ("Alphabet", 5) ' A CODE-128 barcode
if rc<>0 then exit do
rc = BarcodeSetTextProp ("Text", "123ABCD") ' A text to encode in the barcode
if rc<>0 then exit do
' Creates a barcode in vector-based WMF format.
' Do not use the function with new releases of Crystal reports
' formula = BarcodePicture(1000, 300) -- The barcode picture size = 1000x300 TWIPs
formula = BarcodePicture2(1, 3) ' A CODE 128 with 1 pixel wide modules and width:height ratio of 3:1
' This funtion creates barcodes as raster pictures
loop while false
Due to a bug(?) in the latest Crystal Reports releases, it's not possible to use WMF format to render barcodes. The Graphic Location formula doesn't work with WMF pictures when printing a report.
5 (optional). To debug the code, create a formula field with the following expression and place it below the barcode picture:
formula = BarcodeGetErrorCode ()
Creating a barcode with information from a database/report field
Modify your code as shown below:
do
dim data as string
data = {Table1.Field1} & {Table1.Field3}
...
rc = BarcodeSetTextProp ("Text", data)
...
To paste a field name into the code, double-click it in the Field Tree (Alt+F):

© 2025 StrokeScribe. All rights reserved. Use of any portion of this site constitutes acceptance of our Terms of Use and Privacy Policy. The website material may not be reproduced, except with the prior written permission.