To print bar codes you must use the bar code functions in the supplied FoxPro Link Library (FLL). 

Note: Before you run your Report, you must use the SET LIBRARY command to give your application access to functions in a library. See: Using the SET LIBRARY command

Printing bar codes in a FoxPro Report

The quickest and simplest way to print bar codes is by using the Report Designer or Label Designer to create and modify reports or labels. 

The Label Designer is the same as the Report Designer, using the same menus and toolbars. The main difference is that the Label Designer automatically defines the page and its columns based on the size of label you select.

When the Report Designer or Label Designer window is active, Visual FoxPro displays the Report menu and the Report Controls toolbar.

To quickly create a simple report or label layout, choose Quick Report... on the Report menu.

Design your Report or Labels

Before you can print bar codes, you must do the following;

- Design your Report in the usual way.

Test your Report or Labels

Before you print bar codes, it is a good idea to do the following;

- Test your report or labels to see if it is printing the right data.

Use Print Preview to test if it is displaying the data you want, and in the correct format. For example, you might want leading zeros on numbers, or if you want to add prefix characters to numbers, etc.

Print your data the way you want it

You should now have tested your Report or Labels, and it should print your data in the format you require.

TIP: If your report uses data from a Query, then is usually better to create bar codes in the Query, not in the Report. In general, it is better to use data from a Query, instead of a Table to create a Report; because a Query can be modified easily.

Using a Field control to print bar codes

Your data can now be printed as bar codes. Bar codes are printed using a Field control.

You can create controls on your report or label with the Report Controls toolbar. 

- Select menu View | Toolbars... and check the Report Controls box. Click OK.

Click the Field control button, position the mouse pointer on the report, and click the report to place the control or drag it to size.

To use the Expression Builder click the button next to the Expression box.

Calculating bar codes

Bar codes are calculated using bar code functions. See Bar code functions for a complete list or all bar code functions, that you can use to create all types of bar codes. For example, use function CIA_ITF_A() to create Interleaved 2-of-5 (ITF) bar codes, use function CIA_CODE128() to create Code 128 bar codes, etc.

Example: If you want to print a field called StockNumber as a Code 128 bar code, then use this expression in your Query.

CIA_CODE128( StockNumber )

When you run your Report you will see strange characters in the field.

CIA_CODE128( RTRIM ( StockNumber) )

Because character fields contain trailing spaces, you must remove them when you use a bar code function.

Note: Before you run your Report, you must use the SET LIBRARY command to give your application access to functions in a library. See: Using the SET LIBRARY command

Preview the Report 'before' you select a bar code font

If you Preview the Report 'before' you select a bar code font, you can test if the bar code functions are calculating the bar codes.

The bar code function will produce some strange characters.

Selecting a bar code font

The final task is to print the field using a bar code font.

- In your Report, select the field object you want to print as a bar code.

Note: For each bar code function, there is a font and font size to use. 

See: Bar code font name and font size to use to discover the font and font size to select.

- Set the Font and Font Style and Size property using menu Format | Font... 

Bar code fonts should always be printed using Font style set to Regular (never Bold).

For example, to print Interleaved 2-of-5 (ITF) bar codes, use font name CIA ITF Medium and font size 14

Note: There are several different fonts for printing Interleaved 2-of-5 (ITF) bar codes CIA ITF Bearer, CIA ITF Bearer 2CIA ITF Normal, CIA ITF Medium and CIA ITF Tall.

See: Bar code font name and font size to use to discover the font and font size to select.

Note: It is correct to see boxes inside the bar code, when you design the Report. Some boxes may appear, because the display is the function name (not the function result). When you preview or print the report, you will see the function result - and no boxes will appear.

Print Preview

When you Print the report, or Print Preview the report, the bar codes are printed automatically

Note: Before you run your Report, you must use the SET LIBRARY command to give your application access to functions in a library. See: Using the SET LIBRARY command

Printing human-readable text below the bar code

Human Readable text is usually printed below bar codes. The Human Readable text is only different from the field in your Tables, if the bar code adds a check character, and the check characters is normally print in the Human Readable text (this depends on which bar code standard you use).

Note: Some bar codes do not print the check digit / check character in the Human Readable. Code 128 - never prints check character in Human Readable text.

If the Human Readable must also display the check character then the Human Readable text must be calculated using a function (using a similar method to the bar code).

Example: Interleaved 2-of-5 (ITF) bar codes can have a check digit added. If the check digit is added then the Human Readable text below the Interleaved 2-of-5 (ITF) bar codes must be calculated to show the added check digit.

CIA_ITF_A_H( StockNumber )

If the bar code has no check digit (or check character) in the Human Readable text, simply print the text from your field, below the bar code.

Note: Code 39, ITF, Codabar - only print check character in Human Readable text, if the optional check character is in the bar code.

Note: UPC (UPC-A, UPC-E), EAN (EAN-13, EAN-8), ISBN, ISSN - always prints the check digit in the Human Readable text. The bar code font automatically prints the Human Readable text.

Note: Code 128 has a check character in the bar code, but never in the Human Readable text below the bar code.

 

 

 


Copyright 2000 CIA (BAR CODES) UK. All rights reserved. Reproduction prohibited.