// ..\SAMPLES\PRNPDF.PRG
#Include "FiveWin.ch"
STATIC oWnd
FUNCTION Main()
DEFINE WINDOW oWnd FROM 1, 1 TO 20, 60 TITLE "Printing a PDF"
@ 3, 3 BUTTON "&Print me" OF oWnd SIZE 80, 20 ;
ACTION( ( oWnd:Minimize(), PrintMe() ), oWnd:End() )
ACTIVATE WINDOW oWnd
RETURN NIL
FUNCTION PrintMe()
LOCAL oPrn AS OBJECT
LOCAL cError, cSeqErro, nLin, nLinha, oFont
IF .NOT. FILE( "ERROR.TXT" )
? "ERROR.TXT ??"
BREAK
ENDIF
IF FILE( "ERROR.PDF" )
DELETEFILE( "ERROR.PDF" )
ENDIF
BEGIN SEQUENCE
cSeqErro := MemoRead( "ERROR.TXT" )
cError := ALLTRIM( cSeqErro )
PRINTER oPrn NAME "Test PDF" PREVIEW MODAL
PRINT oPrn PREVIEW FILE "error.pdf"
DEFINE FONT oFont NAME "COURIER NEW" SIZE 0, -10 OF oPrn
oPrn:SetPage(9) // A4
oPrn:SetPortrait() // Vertical
PAGE
nLin := 1
FOR nLinha = 1 TO MLCOUNT( cError, 100 )
SYSREFRESH()
CURSORWAIT()
oPrn:CmSay( nLin := nLin +.4, 1.5, MEMOLINE( cError, 100, nLinha), oFont )
IF nLin > 25
nLin := 1
ENDPAGE
PAGE
ENDIF
NEXT
ENDPAGE
oPrn:lMeta = .T.
ENDPRINT
oFont:End()
END SEQUENCE
RETURN NIL
// FIN / END
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 74 guests