Unfortunately when it's printing in a loop (a bunch of staffs tax calculation), it will eventually generates internal error
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
#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
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 71 guests