FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour printer trouble
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
printer trouble
Posted: Mon Feb 02, 2009 03:58 PM
Hi all,

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.

#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
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
Re: printer trouble
Posted: Mon Feb 02, 2009 04:28 PM
In the meanwhile i found out that using
   oPrn := TPrinter():New( "test.pdf", .f., .f., cPrinter, .f., .f. )
works ok

but
   PRINT oPrn  NAME OemToAnsi( "test.pdf" ) TO cPrinter
fails.

I think that this is caused in function PrintBegin( cDoc, lUser, lPreview, xModel, lModal, lSelection ) of tPrinter class.
May be that the GetProfString() calls don't give the desired results?

Regards,
Detlef
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: printer trouble
Posted: Mon Feb 02, 2009 04:32 PM

Detlef

Which fwh version are you using ? and what os Vista or xp ?

see the topic below, this is an outstanding problem hopefully fixed in 9.01 Antonio ?

viewtopic.php?f=3t=14132

HTH

Richard

&

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: printer trouble
Posted: Mon Feb 02, 2009 04:53 PM

Detlef,

Could you please try it with FWH 9.01 ? thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
Re: printer trouble
Posted: Mon Feb 02, 2009 04:59 PM

Richard, Antonio

i'm using FWH 8.12 and Windows XP.
I'll download and change to FWH 9.01 and inform you if it works.

Regards,
Detlef

Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
Re: printer trouble
Posted: Mon Feb 02, 2009 11:11 PM
Richard and Antonio,

with FWH 9.01 my problem is solved.
can now use
PRINT oPrn  NAME OemToAnsi( "test.pdf" ) TO cPrinter
and its working fine.
No need to call
oPrn := TPrinter():New( "test.pdf", .f., .f., cPrinter, .f., .f. )

Thanks and regards,
Detlef

Continue the discussion