# How to Dynamically Change Values in Populated _PDPARMS

ID: Q118553

The information in this article applies to:

- Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a, 2.5b, 2.6

## SUMMARY

To change values or escape codes in the _PDPARMS array programmatically and have them take effect the next time a print job is sent to the printer, you must use the Xbase version of the non-PostScript printer drivers instead of the C-based driver, which is DRIVER2.PLB.

## MORE INFORMATION

When DRIVER2.PLB is used, the _PDPARMS array is populated when the default printer driver is set. After that, _PDPARMS is not read from memory, and DRIVER2.PLB, along with the settings saved in the FOXUSER.DBF, controls how the escape codes are sent to the printer. Therefore, any changes that are made programmatically to _PDPARMS are ignored.

To change the printer driver from DRIVER2.PLB to the non-PostScript Xbase driver, DRIVER.PRG, do the following:

1. Open the GENPD.PJX project, which is normally found in the

       <FoxPro_directory>\GOODIES\PDRIVERS subdirectory.

2. Open the GEN_PD.PRG file and search for the following line:

          _PDRIVER = "DRIVER.PRG"

3. Follow the instructions in GEN_PD.PRG that describe how to use the Xbase

       version of the non-PostScript printer driver.

4. Rebuild the GENPD.APP file and copy it into the main FoxPro directory.

The code below demonstrates how to programmatically change to condensed and bold print by changing the escape codes in _PDPARMS. The array elements that control condensed and bold printing are _PDPARMS(9) and _PDPARMS(11), respectively. This code assumes that there is a printer driver named HP3 saved in the Printer Driver Setup dialog box. Note that the escape codes below are case sensitive.

       ** Begin Code Example **

       SET PDSETUP TO "hp3"
       SET PRINTER TO LPT1
       SET PRINTER ON
       **
        _PDPARMS(9)=CHR(27)+"(s16.6H"      && Set up for condensed print.
       _PDPARMS(11)=CHR(27)+"(s3B"         && Turn on bold.
       **
       ?"This is a test of printing in BOLD and CONDENSED."
       **
       _PDPARMS(9)=CHR(27)+"(s10H"         && Return to normal printing.
       _PDPARMS(11)=CHR(27)+"(s0B"         && Not bold.
       **
       ?"Now return to normal printing"
       **
       SET PRINT OFF
       SET PRINT TO

       ** End Code Example **

For a listing of the array elements in _PDPARMS, please see the following article in the Microsoft Knowledge Base:

       ARTICLE-ID: Q95309
       TITLE     : How _PDPARMS Array Is Created for a Printer Driver
                   Setup

Additional reference words: FoxDos 2.00 2.50 2.50a 2.50b 2.60 pdparms KBCategory: kbprg kbcode KBSubcategory:

Last Reviewed: April 18, 1995 © 1999 Microsoft Corporation. All rights reserved. Terms of Use.