Using Printer Drivers in Coded OutputLast reviewed: December 18, 1995Article ID: Q88579 |
The information in this article applies to:
SUMMARYTo use a printer driver in a FoxPro application, additional code is required. The text below provides examples of the necessary code.
MORE INFORMATIONNOTE: The following code may need to be modified to work with your specific printer.
PostScript DriverThe PostScript printer driver is unique because it is the only driver that parses the data it receives and adjusts the output for any special characters it receives. For example, when a left parenthesis ("(") is printed with the PostScript driver, the driver adds a backslash character (\) to the data stream. For this reason, a printer driver must not be affected when the PDDOCST and PDDOCEND procedures make these changes. The value returned from these procedures is sent to the PDOBJECT procedure and evaluated. The following code fragment demonstrates how to use a PostScript printer driver in an application:
SET TALK OFF * * Set PDSETUP to any valid PostScript printer driver listed in the * FOXUSER database. SET PDSETUP TO "PALATINO 10" SET LIBRARY TO GOODIES\PDRIVERS\PSAPI.PLB * * To print to a network printer, change the following command. SET PRINTER TO TEST.TXT SET PRINT ON * * Save the printer driver setup and remove the printer driver. * Doing so prevents the PostScript printer driver from interpreting * the information in the page header. Afterwards, set the printer * driver back to its initial setting. * X=SET("PDSETUP") SET PDSETUP TO ?PDDOCST(_PLENGTH,128) SET PDSETUP TO (X) ? "This is a test" * * Return the printer driver to its initial setting. * X=SET("PDSETUP") SET PDSETUP TO ?PDDOCEND() SET PRINT OFF SET PRINTER TO SET LIBRARY TO Non-PostScript PrinterThe following code fragment demonstrates how to use the Hewlett-Packard Printer Control Language (HP-PCL) printer driver in an application:
SET TALK OFF SET PDSETUP TO "HP" SET LIBRARY TO GOODIES\PDRIVERS\DRIVER2.PLB * * To print to a network printer, change the following command. SET PRINTER TO TEST.TXT SET PRINT ON PRINTJOB ? PDDOCST(_PLENGTH,128) ? "This is a test" ? PDDOCEND() ENDPRINTJOB SET PRINT OFF SET PRINTER TO SET LIBRARY TO SET PDSETUP TO "HP" .PRG in GENPD.APPNOTE: The following code may need to be modified to work with your specific printer. When you are using _pdriver="driver.prg" in GENPD.APP, use the following code:
SET TALK OFF SET PDSETUP TO "HP" SET PROCEDURE TO GOODIES\PDRIVERS\DRIVER.PRGNOTE: Instead of using SET LIBRARY TO, you use SET PROCEDURE TO.
|
Additional reference words: FoxDos 2.00 2.50 2.50a 2.50b 2.60 2.60a report
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |