Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trouble switching printers
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
Trouble switching printers
Miscellaneous
Thread ID:
00841753
Message ID:
00841753
Views:
51
I have an application where the users need the ability to direct print output to a printer other than their default Windows printer. (We suggested having the users simply change the Windows default as needed but they said that is unacceptable. They want most Windows output to go to the user's regular printer -- the Windows default -- but output from our application to go to a remote location associated with the user ID). Let me describe what I am doing and maybe someone can say why it isn't working.

Two fields have been added to the user table:

1. Flag indicating whether our application should print to the Windows default printer or to a printer selected by the user.
2. User-selected printer name.

A simple dialog has an option group which controls the flag and a list box with a list of available printers. The list is populated by APRINTERS() and the second column is the bound column.

The procedure through which all reports get routed checks the flag and temporarily alters the print destination if the value of the flag is 'U'. (That means use the user-designated printer; 'W' means use the Windows default printer). Here is the code:

IF m.PrinterCur = 'U'
m.lcSavePrinter = SET('PRINTER',2)
* Syntax depends on whether it is a network printer
IF '\\' $ m.PrinterID
SET PRINTER TO NAME (ALLTRIM(m.PrinterID))
ELSE
SET PRINTER TO (ALLTRIM(m.PrinterID))
ENDIF
ENDIF
REPORT FORM &creport ;
TO PRINT NOCONSOLE
* Switch back to Windows default if necessary
IF m.PrinterCur = 'U'
IF '\\' $ m.lcSavePrinter
SET PRINTER TO NAME (ALLTRIM(m.lcSavePrinter))
ELSE
SET PRINTER TO (ALLTRIM(m.lcSavePrinter))
ENDIF
ENDIF

I have been testing this with a physical printer, connected through a LAN, and an Adobe Acrobat printer driver. No matter what settings I use, though, reports always print to the physical printer. For example, if I use the dialog to set the flag to U and select the Acrobat "printer" in the list box, the report still goes to the physical printer. The value of m.PrinterID is 'LPT1:'.

Is this some anomaly of working with Acrobat printer drivers, or is there a flaw in my code? I suspect the latter because a coworker who has two physical printers has tested the code and says reports always print to the Windows default printer no matter which one he selects within our application.

Any help appreciated. Thanks in advance!

Mike
Next
Reply
Map
View

Click here to load this message in the networking platform