RE: SET PRINTER TO NAME... doesn't, sometimes?

Author: Chris Davis

Posted: 2005-04-11 at 17:40:11

Ted we are doing something very similar but not with the same printer

driver.

Here is some snips of our code.

(in the click of the pdf button)

lc_printer = Set('printer',2)

If Thisform.setprinter()

Report Form &lcReport &lcScope To File pdf\temp.ps Noconsole

Set Printer To (lc_printer)

...

Endif

(In the setprinter method on the print dialog form)

llSuccess=.t.

ON ERROR llSuccess=.f.

SET PRINTER TO NAME PDFPrinter

ON ERROR oError.Handle(ERROR(), PROGRAM(), LINENO())

IF !llSuccess

MESSAGEBOX("Could not find the PDF Printer")

ENDIF

RETURN llSuccess

We've never had a problem.

Hope this helps.

Regards

Chris.

-----Original Message-----

From: profoxtech-bounces@leafe.com [mailto:profoxtech-bounces@leafe.com] On

Behalf Of Ted Roche

Sent: 11 April 2005 23:20

To: profoxtech@leafe.com

Subject: SET PRINTER TO NAME... doesn't, sometimes?

We've got a vertical niche app running in VFP 7, and have coached the

clients through installing PDF995 as a printer driver and it is working

very well for them to pick manually from a REPORT FORM TO PRINT PROMPT

situation. Now, we'd like to be able to offer them the ability to print

to a PDF as part of a pre-report dialog.

Basically, the code is picking the PDF995 printer from the list in

APRINTERS() ('cause some workstations have 'PDF995' installed and some

'PDF995Share') and issuing a:

SET PRINTER TO NAME lcPrinter

In the Debug window we are seeing SET("PRINT",2), the windows default,

stay the same, and SET("PRINT",3), the VFP currently selected printer,

switch to the PDF995 printer. That command is followed by a REPORT FORM

TO PRINTER.

Sometimes, it generates the PDF. Sometimes it comes out the Windows

default printer.

We've tried throwing in various time delays (WAIT NOWINDOW TIMEOUT and

DOEVENTS()) with no change.

Reports are all stripped of printer information.

Ideas?

Ted Roche

Ted Roche & Associates, LLC

http://www.tedroche.com

[excessive quoting removed by server]

©2005 Chris Davis