ID: Q101300
The information in this article applies to:
If one of the Epson printer drivers is chosen for a printer driver and the PDDOCEND procedure is called, the top of the page will be reset to where the printer stops printing instead of to the true top of the page. Unless the printer is manually realigned with the top of the page, each page of future output will be split over two pages.
The printer driver sends the setup code [_PDPARMS(3)] for the printer. This code initializes the printer and resets the printer's top of page setting.
To work around this problem, do ONE of the following:
-or-
-or-
In order to modify the P_CODES table it is necessary to thoroughly understand how to control the specific printer using whatever language the printer requires. For example, HP laser printers use a language called 'PCL' or Printer Control Language, PostScript printers use various 'levels' of the PostScript language, and dot matrix printers use specific code sequences preceded by an attention or ESCAPE character, usually CHR(27). Consult your printer documentation or contact the manufacturer for more information on sending codes to your specific printer.
The P_CODES table contains fields with descriptive field names that describe the function of the printer code contained within the field. For example, the P_6LPI field contains the code to set the printer to 6 lines per inch, if applicable. Because this article discusses the codes used to reset the printer, any such escape codes or commands should be stored in the P_SETUP field of the P_CODES table.
To modify the P_SETUP field for the Epson E/F/J/RX/LQ driver, open the P_CODES database, and move the record pointer to the record where
'Epson E/F/J/RX/LQ' is contained in the P_NAME field. You can then
add a formfeed character to the existing setup code by issuing the
command
REPLACE P_SETUP WITH CHR(12)+P_SETUP
in the command window.
For more information about modifying the P_CODES database, please see
the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q89000
TITLE : How to Edit the FoxPro P_CODES Database
The following code reproduces this problem. To use this code without the printer driver loaded, comment out the lines that contain "&& Comment this".
SET TALK OFF
_PEJECT="NONE"
_PADVANCE="FORMFEED"
* The following line of code will set the printer driver to the
* Epson E/F/RX/LQ driver.
_PDSETUP="Epson Generic" && Comment this
* The following line of code will enable FoxPro to use the
* DRIVER2.PLB library file, which contains the code to print
* using escape codes.
SET LIBRARY TO c:\<foxpro>\goodies\pdrivers\driver2.plb && Comment this
SET PRINTER TO dummy.txt
SET PRINTER ON
PRINTJOB
FOR x = 1 TO 32
? x
ENDFOR
* The following line of code will send the End of Document escape
* codes. This is a procedure contained in the DRIVER2.PLB library.
? PDDOCEND() && Comment this
ENDPRINTJOB
SET PRINTER OFF
SET PRINTER TO
* The following line of code will remove the DRIVER2.PLB library
* from memory.
SET LIBRARY TO && Comment this
MODIFY COMMAND dummy.txt
Additional reference words: FoxDos 2.00 2.50 pdparms
KBCategory: kbprint kbprg kbprb
KBSubcategory: FxprintDriver
Last Reviewed: May 22, 1995