How to Print Labels on a Laser Printer from FoxPro

ID: Q89092

The information in this article applies to:

SUMMARY

Printing labels to a Hewlett-Packard (HP) laser printer without a printer driver requires that certain escape codes be sent to the printer before the command to print the labels.

MORE INFORMATION

To print 1- by 4-inch labels contained on a two column and ten row label sheet, execute code such as the following:

   SET DEVICE TO PRINTER
   ??? CHR(27)+'E'        && Reset
   SET DEVICE TO SCREEN

   SET PDSETUP TO
   ??? CHR(27)+'&l8.00C'  && Line height 8/48" (LPI 6)
   ??? CHR(27)+'&l3E'     && Top margin 3 lines
   SET DEVICE TO SCREEN
   LABEL FORM <labelname> TO PRINTER

   SET DEVICE TO PRINTER
   ??? CHR(27)+'E'        && Reset
   SET DEVICE TO SCREEN


   NOTE: The escape code lines that contain an ampersand (&) use a
   lowercase "L", not a number 1.

In the label generator, use the following settings:

   Margin - 3
   Width  - 40
   Number across - 2
   Height - 6
   Lines between - 0
   Spaces between - 0

The above settings are only an example and may need to be modified for specific labels, printers, and applications. For exact escape code sequences, consult your printer's manual.

Additional reference words: FoxDos FoxUnix 2.00 2.50 2.50a 2.50b 2.60 2.60a laserjet Laser Jet

Keywords          : kbcode FxprintGeneral 
Version           : 2.00 2.50x 2.60 2.60a | 2.60
Platform          : MS-DOS UNIX

Last Reviewed: July 23, 1998