i have the following problem with the FiveWin printer commands.
I want to print to a specified printer.
To find the correct name i called the function aPrinters := aGetPrinters().
Here the content of aPrinter:
---------------------------
Microsoft XPS Document Writer
Microsoft Office Document Image Writer
HPLaser
Adobe PDF
---------------------------
If i use the name 'HpLaser' and try to print on it nothing happens.
- Code: Select all Expand view
#include "FiveWin.ch"
////////////////
PROCEDURE Main()
////////////////
LOCAL aPrinter := {}
LOCAL cPrinter := ""
LOCAL cMsg := "available printers:" + CRLF
aPrinter := aGetPrinters()
for each cPrinter in aPrinter
cMsg += CRLF + cPrinter
TryPrint( cPrinter )
next
? cMsg
RETURN
/////////////////////////////////////
STATIC PROCEDURE TryPrint( cPrinter )
/////////////////////////////////////
LOCAL oPrn
if !MsgYesNo( "Start printing to" + CRLF + "'" + cPrinter + "'" )
RETURN
endif
// PRINT oPrn NAME OemToAnsi( "test.pdf" ) FROM USER
PRINT oPrn NAME OemToAnsi( "test.pdf" ) TO cPrinter
oPrn:StartPage()
oPrn:Say( 50, 50, "Test print to '" + PrnGetName() + "'" )
oPrn:EndPage()
oPrn:End()
RETURN
If i use Print .... FROM USER and choose 'HPlaser' in the printer select dialog it prints fine?
Am i doing something wrong?
Regards,
Detlef