Crystal Reports
Adding barcodes to reports
Overview
This document provides an overview of barcodes, how barcodes work in the
Crystal Reports Designer, and examples of the barcode font types. This document has been written for Crystal Reports 9 and earlier.
Contents
I
NTRODUCTION
............................................................................................ 2
W
HAT IS A BARCODE
?................................................................................. 2
Examples of standard barcode fonts .................................................................. 2
Example of non-standard barcode fonts............................................................. 3
U
SING BARCODES IN
C
RYSTAL
R
EPORTS
..................................................... 3
Installing barcodes and the barcode UFL........................................................... 3
Steps to verify that the barcode UFL has been successfully installed ................ 4
D
ISPLAYING BARCODES IN
C
RYSTAL
R
EPORTS
............................................. 5
Code 39.............................................................................................................. 5
Code 128............................................................................................................ 6
Postnet ............................................................................................................... 7
PDF417.............................................................................................................. 8
W
HAT FONT APPLIES TO WHICH BARCODE FUNCTION
? .................................. 9
F
INDING
M
ORE
I
NFORMATION
.................................................................... 10
C
ONTACTING
C
RYSTAL
D
ECISIONS FOR
T
ECHNICAL
S
UPPORT
.................... 10
6/23/2003 3:00 PM
Copyright
2003 Crystal Decisions, Inc. All Rights Reserved.
Page 1
Crystal Reports Adding barcodes to reports
Introduction
This document outlines the following:
What is a barcode?
• An explanation of barcode fonts
•
Using barcode creation functions and the User Function Library (UFL) in
Crystal Reports
A barcode is a series of vertical black and white stripes that are read by a barcode scanner. The vertical black and white lines can contain product information, such as price, weight, and size. Once it has been scanned, the barcode is translated and often printed out onto a receipt.
For example, in a retail store, the clerk can scan the barcode instead of manually entering a 20-digit number for each product as it passes through the checkout counter. This allowed a quick, easy and inexpensive method of data input for retail stores.
There are different types of barcode fonts for the unique needs of various industries.
For example, UPC symbols are used on, but not limited to, compact disks
(CDs), grocery items, and magazines while Code 39 is used in video rental stores, on identification (ID) cards, and for labels. Code 128 is a code made up of symbols used often by the shipping industry.
Examples of standard barcode fonts
Code 39
UPC
Code 128
6/23/2003 3:00 PM
Copyright
2003 Crystal Decisions, Inc. All Rights Reserved.
Scr_barcodes.pdf
Crystal Reports
Example of non-standard barcode fonts
PDF417
Adding barcodes to reports
Using barcodes in Crystal Reports
Installing barcodes and the barcode UFL
To create barcodes in Crystal Reports, you must first purchase a barcode font set from a vendor such as Azalea Software. Install the barcode fonts according to the instructions provided by Azalea Software. Also, you need to download the latest barcode User Function Library files (UFLs) from their web site at: http://www.azalea.com/
Currently, there are two types of barcode UFLs available for download. One is for use in creating the standard, conventional barcodes. This barcode UFL has two versions; one is for use with the Azalea Software version 4-font set and one is for use with the version 5-font set. The other type of barcode UFL is for use with the PDF417 barcode font set only.
Once you have successfully downloaded the appropriate barcode UFL file, you will need to extract the two UFL driver files to the correct locations depending on the operating system, Crystal Reports version and the barcode UFL. Refer to
Table A for Crystal Reports 9 and Table B for Crystal Reports 8.5 and earlier.
Table A: File location of barcode UFL drivers for Crystal Reports 9
Operating system
Windows
NT
Windows 9x,
ME, XP
Windows
NT
Barcode
UFL type
Barcode
UFL (for standard, conventional barcode font sets)
Barcode
UFL (for standard, conventional barcode font sets)
PDF417
UFL (for
PDF417 font only)
Driver File names
File location
Barcode.dll C:\winnt\system32
U2lbcode.dll
Barcode.dll C:\windows\system32
U2lbcode.dll
Pdf417mba.dll C:\winnt\system32
U2lpdf417.dll
C:\Program Files\Common Files\Crystal
Decisions\2.0\bin
C:\Program Files\Common Files\Crystal
Decisions\2.0\bin
C:\Program Files\Common Files\Crystal
Decisions\2.0\bin
6/23/2003 3:00 PM
Copyright
2003 Crystal Decisions, Inc. All Rights Reserved.
Scr_barcodes.pdf
Crystal Reports Adding barcodes to reports
Windows 9x,
ME, XP
PDF417
UFL (for
PDF417 font only)
Pdf417mba.dll C:\windows\system32
U2lpdf417.dll C:\Program Files\Common Files\Crystal
Decisions\2.0\bin
Table B: File location of barcode UFL drivers for Crystal Reports 8.5 and earlier
Operating system
Barcode UFL type Driver File names File location
Windows NT
Barcode UFL (for standard, conventional barcode font sets)
Barcode.dll C:\winnt\system32
U2lbcode.dll C:\winnt\crystal
Windows 9x,
ME, XP
Barcode UFL (for standard, conventional barcode font sets)
Barcode.dll C:\windows\system
32
U2lbcode.dll C:\windows\crystal
NOTE
Steps to verify that the barcode UFL has been successfully installed
1. Launch Crystal Reports.
2. From the Insert menu, select Field Object to open the Field Explorer dialog box.
3. Select Formula Fields and click New.
4. Type a formula name. For example, “test”. The Formula Editor dialog box opens.
5. Find the available barcode fonts under the section heading Additional
Functions.
Now that the barcodes fonts are available in Crystal Reports, you can create barcodes in a report.
Creating barcodes in the Seagate Info Report Designer is the same as creating barcodes in the
Crystal Reports Designer. The same steps apply.
NOTE
You can obtain the most up-to-date barcode font sets and UFLs from Azalea at http://www.azalea.com
6/23/2003 3:00 PM
Copyright
2003 Crystal Decisions, Inc. All Rights Reserved.
Scr_barcodes.pdf
Crystal Reports Adding barcodes to reports
Displaying barcodes in Crystal Reports
Crystal Reports uses the barcode UFL to display barcodes in a report. In the following sections, you will find examples of formulas, which contain barcode functions and methods to be applied in Crystal Reports.
NOTE
The following examples require that you are familiar with creating formulas in Crystal Reports. For information on how to create formulas, refer to the Crystal Reports Online Help by pressing F1.
Code 39
Background
Code 39 barcode can contain an alphanumeric string. BarcodeC39() is a function available in Crystal Reports that displays standard Code 39 barcodes. Code 39 is an industry standard barcode as defined by the American National Standards
Institute (ANSI). This barcode is used as the standard for many government institutions.
The arguments that are accepted by this function can contain the numbers 0-9, the letters A-Z, both uppercase and lowercase, to a maximum formula output of
254 characters. The formula in this section returns a value that Code 39 can understand when scanned.
Steps to display Code 39 barcodes
To display Code 39 barcodes, create a formula in Crystal Reports and then apply the applicable barcode font format.
1. Create a formula in Crystal Reports similar to the following:
//Formula to display Code 39 barcodes
BarcodeC39(“ABC123ab”)
2. Insert the formula field onto the report.
Notice that the following syntax is displayed on the report:
*ABC123+A+B*
The delimiter characters (*) at the beginning and at the end of the barcode syntax indicate to the scanner where the barcodes starts and finishes.
6/23/2003 3:00 PM
Copyright
2003 Crystal Decisions, Inc. All Rights Reserved.
Scr_barcodes.pdf
Crystal Reports Adding barcodes to reports
3. Select the formula field and format it by selecting one of the Code 39 barcode fonts from the drop-down list.
Upon formatting the formula field with a Code 39 barcode font, a series of vertical black and white lines that represent the barcode value appears.
6/23/2003 3:00 PM
When a barcode scanner reads the display, it will return the example’s value of
ABC123abc.
For more information on this barcode, refer to: http://www.mecsw.com/specs/code_39.html
Code 128
Background
Code 128 barcode fonts are selected due to its density for numeric data and its wide selection of characters. Automatic Identification Manufacturers (AIM) maintains this barcode.
To find out more about AIM, click on the following link: http://www.aimi.org/
The Code 128 barcode function is divided into three subsets of data. Subsets A and B can contain alphanumeric strings. Subset C can contain a numeric string.
All three Code 128 barcode functions use the same syntax. The difference between these three codes is what each code supports, and how each code calculates the checksum at the end of the code.
• BarcodeC128A() supports standard ASCII symbols, digits, upper case characters and other code 128 control codes.
• BarcodeC128B() supports standard ASCII symbols, digits, upper and lower case letters.
• BarcodeC128C() compresses two numeric digits so that the total length of the barcode is half the length of the other two barcode subsets.
The formula in this section returns a value that Code 128 can understand when scanned.
Copyright
2003 Crystal Decisions, Inc. All Rights Reserved.
Scr_barcodes.pdf
Crystal Reports
6/23/2003 3:00 PM
Adding barcodes to reports
Steps to display Code 128 barcodes
To display Code 128 barcodes, create formulas in Crystal Reports and then apply the applicable barcode font.
1. Create three formulas in Crystal Reports similar to the following:
Example formula A:
//Formula to display subset A of Code 128 barcodes
BarcodeC128A(“A..234”)
Example formula B:
//Formula to display subset B of Code 128 barcodes
BarcodeC128B(“123ABCa”)
Example formula C:
//Formula to display subset C of Code 128 barcodes
BarcodeC128C(“4567”)
2. Insert the formulas onto the report.
Notice that the following syntax is displayed on the report:
• For example formula A, the syntax displayed is A 234.
• For example formula B, the syntax displayed is 123ABCa.
• For example formula C, the syntax displayed is 4567.
3. Select the formula field and format it by selecting one of the Code 128 barcode fonts from the drop-down list.
Upon formatting the formula fields with a Code 128 barcode fonts, a series of vertical black and white lines that represent the barcode values appear.
When a barcode scanner reads the display, it returns the Code 128 examples’ values.
For more information on this barcode, refer to: http://www.mecsw.com/specs/code_128.html
Postnet
Background
Postnet barcode contains a ZIP code. The American Postal Service uses this barcode to automatically sort mail.
BarcodePostnet(ZIP code) is the function in Crystal Reports that displays an
American Postal Service barcode. The ZIP codes can be five-digit, nine-digit or eleven-digit in length. This function also supports the hyphen (-) character. The formula in this section returns a value that Postnet can understand when scanned.
Copyright
2003 Crystal Decisions, Inc. All Rights Reserved.
Scr_barcodes.pdf
Crystal Reports
6/23/2003 3:00 PM
Adding barcodes to reports
Steps to display Postnet barcodes
To display Postnet barcodes, create a formula in Crystal Reports and then apply the applicable barcode font.
1. Create one of three formulas in Crystal Reports similar to the following:
Example formula for five-digit ZIP codes:
//Formula to display five-digit Postnet barcodes
BarcodePostnet(“12345”)
Example formula for nine-digit ZIP codes:
//Formula to display nine-digit Postnet barcodes
BarcodePostnet(“123456789”)
Example formula for eleven-digit ZIP codes:
//Formula to display eleven-digit Postnet barcodes
BarcodePostnet(“12345678901”)
NOTE
Only select the BarcodePostNet font applicable to 5, 9, or 11 digit zip codes. Do not type all three formulas into the Formula Editor. Select only the one that applies to you.
2. Insert the formula onto the report.
Notice that the following syntax is displayed on the report:
• For the five-digit example formula, the syntax displayed is 12345.
• For the nine-digit example formula, the syntax displayed is 123456789
• For the eleven-digit example formula, the syntax displayed is 12345678901.
3. Select the formula field and format it by selecting the ZipCodeBarcode font from the drop-down list.
Upon formatting the formula fields with the PostNet barcode font, a series of vertical black and white lines that represent the barcode values appear.
When a barcode scanner reads the display, it returns the PostNet examples’ values.
For more information on this barcode, refer to: http://www.mecsw.com/specs/postnet.html
PDF417
Background
PDF417 is a two-dimensional, high-density, non-linear type of barcode. “PDF” stands for Portable Data File. PDF417 barcodes are capable of displaying more information then the standard barcode types. PDF417 barcodes are currently used for labeling hazardous materials, storing technical specifications and calibration data on electronic instruments, and encoding fingerprints and photographs on drivers’ licences.
Copyright
2003 Crystal Decisions, Inc. All Rights Reserved.
Scr_barcodes.pdf
Crystal Reports Adding barcodes to reports
Over 1800 alphanumeric characters or over 2700 numeric digits can be encoded in a single PDF417 barcode. Up to 900 characters can be encoded per square inch.
Steps to display PDF417 barcodes
To display PDF417 barcodes, create a formula in Crystal Reports and then apply the applicable barcode font.
1. Create a formula in Crystal Reports similar to the following:
//Azalea’s example formula to display PDF417 barcodes numberVar rows := simplePDF417DoIt({Your Field Here}); numberVar i := 0; stringVar BarCode := ""; for i := 1 to rows step 1 do
BarCode := BarCode + simplePDF417GetIt(i);
2. Insert the formula onto the report.
3. Select the formula field and format it by selecting one of the PDF417 barcode fonts from the drop-down list.
Upon formatting the formula field with a PDF417 barcode font, a pattern of black and white lines that represent the barcode value appears.
When a barcode scanner reads the display, it will return the example’s value.
For more information on this barcode, refer to: http://www.mecsw.com/specs/pdf417.html
What font applies to which barcode function?
The ‘Table of Azalea Font Sets’ provides a list of font sets available for purchase from Azalea Software. The table includes the corresponding functions and font styles for each font set.
Table C: Azalea Font Sets
Azalea font set Functions
C128Tools
C39Tools
• BarcodeC128C
• BarcodeC128B
• BarcodeC128C
• BarcodeC128Auto
• BarcodeFNC1C
• BarcodeUCC128SSCC
• BarcodeUCC128SSCCPosta l
• BarcodeC39
• BarcodeC39ASCII
Font style
Code 128
Code 39
6/23/2003 3:00 PM
Copyright
2003 Crystal Decisions, Inc. All Rights Reserved.
Scr_barcodes.pdf
Crystal Reports Adding barcodes to reports
UPCTools
PostTools
I2of5Tools
AzaleaMBA
CodaBar
Code93
2of5
• BarcodeUPCA
• BarcodeUPCE
• BarcodeBookland
• BarcodeISSN
• BarcodeEAN8
• BarcodeEAN13
• BarcodePostnet
• Barcode2of5
• Barcode2of5SCCF
• PDF417
• BarcodeCodabarA
• BarcodeCodabarB
• BarcodeCodabarC
• BarcodeCodabarD
• BarcodeCode93
• Barcode2of5
UPC, OCR
ZipCodeBarcode
Interleaved 2 of 5
AzaleaMBA
Codabar
Code 93
2 of 5
Finding More Information
This is a list of references used to create this document. For more information on barcodes, click the following links:
•
Azalea Software
•
The Barcode Software Center
• Rivers Edge
•
CIAX
Contacting Crystal Decisions for Technical Support
We recommend that you refer to the product documentation and that you visit our Technical Support web site for more resources.
Self-serve Support:
http://support.crystaldecisions.com/
Email Support:
http://support.crystaldecisions.com/support/answers.asp
Telephone Support:
http://www.crystaldecisions.com/contact/support.asp
6/23/2003 3:00 PM
Copyright
2003 Crystal Decisions, Inc. All Rights Reserved.
Scr_barcodes.pdf