printer trouble

printer trouble

Postby Detlef Hoefner » Mon Feb 02, 2009 3: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.

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
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Re: printer trouble

Postby Detlef Hoefner » Mon Feb 02, 2009 4:28 pm

In the meanwhile i found out that using
Code: Select all  Expand view
   oPrn := TPrinter():New( "test.pdf", .f., .f., cPrinter, .f., .f. )
works ok

but
Code: Select all  Expand view
   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
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Re: printer trouble

Postby Richard Chidiak » Mon Feb 02, 2009 4: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=3&t=14132

HTH

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: printer trouble

Postby Antonio Linares » Mon Feb 02, 2009 4:53 pm

Detlef,

Could you please try it with FWH 9.01 ? thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41345
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: printer trouble

Postby Detlef Hoefner » Mon Feb 02, 2009 4: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
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Re: printer trouble

Postby Detlef Hoefner » Mon Feb 02, 2009 11:11 pm

Richard and Antonio,

with FWH 9.01 my problem is solved.
can now use
Code: Select all  Expand view
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
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 10 guests