FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Printing to printer
Posts: 283
Joined: Sat Oct 15, 2005 06:40 AM
Printing to printer
Posted: Thu Feb 26, 2009 10:45 PM
Dear friends,
I found a problem with a my storical application, after i update to FWH 8.11 version.
PrimoPDF is a printer installed on my system but if I run the sample, return:
"PrimoPDF is not ready!"
I don't understood why!
How to repair?
Many thanks in advance,
Code (fw): Select all Collapse
FUNCTION Main()

   LOCAL cPrinter := "PrimoPDF", oPrn

   PRINT oPrn NAME "Test fivewin" TO cPrinter PREVIEW  // MODAL

   IF Empty( oPrn:hDC )
      MsgStop( cPrinter + " is not ready!!" )
   ELSE
      MsgINfo( "Printing!" )
   ENDIF
   PAGE
   oPrn:CmSay(  10.0 , 15.0, "TEST" )
   ENDPAGE
   ENDPRINT
   RETURN Nil
Ciao, best regards,

Ugo
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: Printing to printer
Posted: Fri Feb 27, 2009 02:11 AM
If I'm not mistaken, it's a bug in TPrinter class and it happens when someone use "to <cPrinter>" clause on XP. It's fixed in FWH 9.01. Under method new() of Tprinter class, just make it look like this:
Code (fw): Select all Collapse
      cPrinter := GetProfString( "windows", "device" , "" )
      WriteProfString( "windows", "device", cModel )
      SysRefresh()
      PrinterInit()
      ::hDC := GetPrintDefault( GetActiveWindow() )
      SysRefresh()
      WriteProfString( "windows", "device", cPrinter  )
      // PrinterInit()
      // DeleteDC( ::hDC )
      // ::hDC = PrinterDCfromName( cModel )
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 283
Joined: Sat Oct 15, 2005 06:40 AM
Re: Printing to printer
Posted: Fri Feb 27, 2009 02:50 PM
hua wrote:If I'm not mistaken, it's a bug in TPrinter class and it happens when someone use "to <cPrinter>" clause on XP. It's fixed in FWH 9.01. Under method new() of Tprinter class, just make it look like this:

Dear Hua,
you are not mistaken, now work well. :-)

The bug is also on Vista.

Many thanks for your help.
Ciao, best regards,

Ugo

Continue the discussion