How to Print Labels on a Laser Printer from FoxPro

Last reviewed: October 18, 1996
Article ID: Q89092
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6, 2.6a
  • Microsoft FoxPro for UNIX, version 2.6

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

Avery 5161 or 5261 labels measure 1-by-4 inches. One page of labels has two columns of ten labels each. To print this label type, 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
KBCategory: kbprint kbprg kbcode
KBSubcategory: FxprintGeneral


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 18, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.