Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keeping the Printer Properties Settings

Status
Not open for further replies.

trevr1

Programmer
Feb 4, 2003
23
US
Is there a way to keep the printer property settings? For instance, our client often times prints using a "high quality" setting. Each time they print, they have to reselect this setting as the default standard setting is always selected. Any ideas?

We are using VFP 9.
 
There are a couple of ways to go about this....

One way is to use the printer's Programming Command Language (PCL) commands (typically find this on the Net) and embed the appropriate commands within your Report output.

Another way that I set up a client to do something like this was to create a unique Printer within their workstation Windows.

That "printer" was the same as the usual one, but within the Windows Printer Properties, I set it up to use unique settings and named it with a different printer name.

My client's needs was to always use paper tray 2 instead of paper tray 1 for one and only one report. So I set up this "new" printer with these settings as part of its permanent setup.

Then when a VFP application goes to print and requires these settings, it programatically does the following:
* Change the Windows default printer to that "new" printer
* Prints the report
* Returns the Windows default printer to the original one.

Good Luck,
JRB-Bldr
 
Hi Trevr1,

Printer default settings are set by Start->Settings->Printers and right clicking the printer in question and selecting properties.

Whatever changes you make will be the default when the printer is selected.

You can also install another instance of the printer with other default settings.

Regards,

Mike
 
Thanks for the help. I think what jrbbldr said about the Command Language (PCL) commands is what we might need. But I'm not sure.

Our client sometimes prints in high quality and other times at the regular lower default setting. He does need to print several reports in "high quality" on glossy paper for about 10 reports. He gets frustrated because each time he clicks the print button on our system, the printer sets itself back to the default (lower) setting and it doesn't keep the high quality setting in which he just selected. So each time he prints, he must go into the printer properties and select the "high quality" setting.

Is there a fox command or setting that will save the current printer settings he has selected?
 
Hi Trevr1,

Install two instances of the printer, call them HPLow and HPHigh. Set the default properties of the printers and include a SET PRINTER TO NAME GETPRINTER() prior to running the report.

Regards,

Mike
 
What mspratt describes is what I attempted to describe above as Option #2.

I find that to be a very useful and flexible option to use to get what you need done.

Once I have the 2nd, modified version of the Print Driver installed in Windows and named uniquely, I use the following code to incorporate it in the application....

Code:
* --- Determine Original Default Windows Printer ---
lcDefaultPrinter =  SET("PRINTER",2)

* --- Use APRINTERS() To Determine What Printers Available ---
=APRINTERS(aryPrinters)
* --- Name of 1st non-customized version of Print Driver ---
* --- Not necessarily Default Printer ---
*lcOrigPrinter = "Lead Printer" 

* --- Unique Name of 2nd customized version of Print Driver ---
* --- Not Necessarily Default Printer ---
* --- NOTICE Unique Name ---
lcNewPrinter = "Lead Printer - Tray 2" 

* --- Look within this specific workstation's Windows Print Driver list to see if this customized version exists ---
mlFound = .F.
mnRows = ALEN(aryPrinters,1)
FOR mnCntr = 1 TO mnRows
   IF UPPER(lcNewPrinter) $ UPPER(aryPrinters(mnCntr,1))
      lcNewPrinter = aryPrinters(mnCntr,1)
      mlFound = .T.
      EXIT
   ENDIF
ENDFOR

IF mlFound
   * --- Customized Print Driver Found, Use It ---
   * --- Use Windows Scripting To Set Default Printer To New Image Printer ---
   ONET = CREATEOBJECT("WScript.Network")
   ONET.SetDefaultPrinter(lcNewPrinter)

   SET PRINTER TO NAME (lcNewPrinter)


   <do whatever...>


   * --- When Done Printing - Use Windows Scripting To Restore Original Default Printer ---
   ONET.SetDefaultPrinter(lcDefaultPrinter)
   RELEASE ONET

   SET PRINTER TO NAME (lcDefaultPrinter)
ELSE
   mcWaitMsg = " " + lcNewPrinter + " Not Found! "
   WAIT WINDOW mcWaitMsg TIMEOUT 4
ENDIF  && IF mlFound

Good Luck,
JRB-Bldr
 
Thanks for all the help. I see what you're saying now and that would work in my case as we speak.

In the future we plan on bundling up the software package and selling it to potentially 100's of other companies. I don't think the above would work then because we couldn't setup a customized printer driver for each company. It would be too time consuming.

I see many applications especially photo editing ones that keep your printer property settings after you select a non default setting. This is what we're looking for. Looks like this might be a shortcoming of fox and you will have to jerry-rig a printer driver to make it work.

Once again guys I want to thank you for the help. Much appreciated!!
 
"I don't think the above would work then because we couldn't setup a customized printer driver for each company."

Unfortunately the same holds true for considering using the PCL (Programming Command Language) approach.

Since each company may have a different printer and each printer MAY have a unique PCL command set, you could very likely encounter the same difficulty.

While it is a somewhat old-style approach, you COULD create your own PCL reference table defining multiple printers and include it with your application. And, as your customers ask for new printers, you would add the information and send the updated reference table.

In that way you could have your application support multiple printers and use a client configuration routine to allow your customers pick THEIR printer(s) from your list.

Good Luck,
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top