After how many times in the loop?Unfortunately when it's printing in a loop (a bunch of staffs tax calculation), it will eventually generates internal error
Assigning lUseHaruPdf when TPrinter is sub-classed
- nageswaragunupudi
- Posts: 10733
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 11 times
- Contact:
Re: Assigning lUseHaruPdf when TPrinter is sub-classed
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 10733
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 11 times
- Contact:
Re: Assigning lUseHaruPdf when TPrinter is sub-classed
I tested this program to generate 200 pdf files silently and all 200 files were created in 1.1 seconds and no crash, no errors and no log files about excess font release.
I have used native fwh library without modifications.
I tested it with FWH1912.
You can try coping this program to fwh\samples folder and try building with buildh.bat or buildx.bat.
I have used native fwh library without modifications.
I tested it with FWH1912.
Code: Select all | Expand
#include "fivewin.ch"
REQUEST FWHARU
REQUEST DBFCDX
function Main()
local nMax := 200
local bData, cData, cPdf, n, nSecs
local cLog := cFileSetExt( ExeName(), "log" )
FWNumFormat( "E", .t. )
TPrinter():lUseHaruPDF := .t.
FERASE( cLog )
AEVAL( DIRECTORY( "CUST???.PDF" ), { |a| FERASE( a[ 1 ] ) } )
USE CUSTOMER NEW VIA "DBFCDX"
GO TOP
bData := &( "{||{ID,TRIM(FIRST) + ', ' + LAST,STREET,CITY,STATE,AGE,SALARY}}" )
nSecs := SECONDS()
MsgRun( "CUST000.PDF", FWVERSION, { |oDlg| cPdf := MultiPDF( nMax, bData, oDlg ) } )
nSecs := SECONDS() - nSecs
? "Created " + cValToChar( nMax ) + " pdfs in " + cValToChar( nSecs ) + " seconds"
HtmlView( TrueName( cPdf ) )
if File( cLog )
WinExec( "notepad.exe " + cLog )
else
? cLog + " not created"
endif
return nil
static function MultiPDF( nMax, bData, oDlg )
local cPdf,cData,n
for n := 1 to nMax
cData := FW_ArrayAsList( Eval( bData ), CRLF, .t. )
cPdf := "CUST" + STRZERO( n, 3, 0 ) + ".PDF"
//
oDlg:cMsg := cPdf
oDlg:Refresh()
SysRefresh()
//
MakePDF( cData, cPdf )
SKIP
if EOF()
GO TOP
endif
next
return cPdf
static function MakePDF( cData, cPdf )
local oPrn, oFont
local nRow, nCol
PRINT oPrn FILE cPdf
DEFINE FONT oFont NAME "COURIER NEW" SIZE 0,-12 OF oPrn
PAGE
for nRow := 1 to 7 step 2; for nCol := 1 to 4 step 3
@ nRow, nCol PRINT TO oPrn TEXT cData SIZE 3,2 INCHES ;
FONT oFont
next; next
ENDPAGE
ENDPRINT
RELEASE FONT oFont
oPrn := nil
return nil
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Assigning lUseHaruPdf when TPrinter is sub-classed
Thanks Rao.
I was using :lUseFWPdf instead of :lUseHaruPdf in my test that ends up with internal error.
I'll try to slowly shift to :lUseHaruPdf and see how it goes
I was using :lUseFWPdf instead of :lUseHaruPdf in my test that ends up with internal error.
I'll try to slowly shift to :lUseHaruPdf and see how it goes
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
BCC5.82/BCC7.3
xHarbour/Harbour