Unfortunately when it's printing in a loop (a bunch of staffs tax calculation), it will eventually generates internal errorAfter how many times in the loop?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Unfortunately when it's printing in a loop (a bunch of staffs tax calculation), it will eventually generates internal errorAfter how many times in the loop?
About 18 and some of the generated pdfs are blank with a filesize of 1.4KB only
#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 nilThanks 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