PRB: Extra Blank Line When Printing Labels

ID: Q99842

The information in this article applies to:

SYMPTOMS

When you are printing labels created with the label generator, an extra blank line is inserted as the first line of the printed output. On all subsequent pages, the contents of each label are then offset incrementally by one line.

CAUSE

This behavior existed in dBASE III and FoxBASE. It was changed in FoxPro version 1.02. However, to maintain compatibility with the large installed base of Xbase applications, a design decision was made to revert to the original behavior.

RESOLUTION

To work around this problem, print the label form to a file, open the file with low-level file functions, remove the carriage return/linefeed (CR/LF) characters and send the file to the printer using the MS-DOS COPY command. For example:

   *--Set the number of lines printed per page and print to a file.
   _PLENGTH=56
   LABEL FORM <form name> ENVIRONMENT PDSETUP TO FILE temp.txt

   *--Open file and replace the CR/LF pair with null characters.
   filehand=FOPEN('temp.txt',2)
   =FGETS(filehand)
   =FSEEK(filehand,-2,1)
   =FWRITE(filehand,chr(0)+chr(0))
   =FCLOSE(filehand)

   *--Copy the file to printer and prevent the appearance of the
   *--MS-DOS screen.
   HIDE WINDOW SAVE ALL
   RUN COPY temp.txt LPT1 > NUL
   SHOW WINDOW ALL

Additional reference words: FoxDos 2.00 2.50 2.50a 2.60 KBCategory: kbprg kbprb KBSubcategory:

Last Reviewed: April 17, 1995