PRINT TO oPrn FILE "name.pdf"
REQUEST FWHARU
function Main()
TPrinter():lUseHaruPDF := .t.
if NOT EXIST %1.prg GOTO :NOEXIST
ECHO Compiling...
if "%FWDIR%" == "" set FWDIR=c:\fwh2006\
if "%XHDIR%" == "" set XHDIR=c:\xharbour
rem if "%2" == "/b" set GT=gtwin
rem if not "%2" == "/b" set GT=gtgui
set GT=gtgui
set hdir=%XHDIR%
set hdirl=%hdir%\lib
set bcdir=c:\borland\bcc74
set fwh=%FWDIR%
%hdir%\bin\harbour %1 /n /i%fwh%\include;%hdir%\include /w /p %2 %3 > comp.log 2> warnings.log
IF ERRORLEVEL 1 GOTO COMPILEERRORS
@type comp.log
@type warnings.log
echo -O2 -e%1.exe -I%hdir%\include -I%bcdir%\include %1.c > b32.bc
%bcdir%\bin\bcc32 -M -c -v @b32.bc
:ENDCOMPILE
IF EXIST %1.rc %bcdir%\bin\brc32.exe -r -I%bcdir%\include -I%bcdir%\include\windows\sdk %1
echo %bcdir%\lib\c0w32.obj + > b32.bc
echo %1.obj, + >> b32.bc
echo %1.exe, + >> b32.bc
echo %1.map, + >> b32.bc
echo %fwh%\lib\Fivehx.lib %fwh%\lib\FiveHC.lib + >> b32.bc
rem echo %fwh%\lib\libmysql.lib + >> b32.bc
rem echo %fwh%\lib\pgsql.lib + >> b32.bc
rem echo %fwh%\lib\libpq.lib + >> b32.bc
echo %hdirl%\hbhpdf.lib + >> b32.bc
echo %hdirl%\libharu.lib + >> b32.bc
echo %hdirl%\png.lib + >> b32.bc
echo %hdirl%\rtl.lib + >> b32.bc
echo %hdirl%\vm.lib + >> b32.bc
echo %hdirl%\%GT%.lib + >> b32.bc
echo %hdirl%\lang.lib + >> b32.bc
echo %hdirl%\macro.lib + >> b32.bc
echo %hdirl%\rdd.lib + >> b32.bc
echo %hdirl%\dbfntx.lib + >> b32.bc
echo %hdirl%\dbfcdx.lib + >> b32.bc
echo %hdirl%\dbffpt.lib + >> b32.bc
echo %hdirl%\hbsix.lib + >> b32.bc
echo %hdirl%\debug.lib + >> b32.bc
echo %hdirl%\common.lib + >> b32.bc
echo %hdirl%\codepage.lib + >> b32.bc
echo %hdirl%\pp.lib + >> b32.bc
echo %hdirl%\pcrepos.lib + >> b32.bc
echo %hdirl%\ct.lib + >> b32.bc
echo %hdirl%\zlib.lib + >> b32.bc
echo %hdirl%\hbzip.lib + >> b32.bc
echo %hdirl%\libmisc.lib + >> b32.bc
echo %hdirl%\tip.lib + >> b32.bc
echo %hdirl%\hbzebra.lib + >> b32.bc
rem echo %hdirl%\png.lib + >> b32.bc
C:\HARUPDF
3/08/2020 12:57 <DIR> .
3/08/2020 12:57 <DIR> ..
0/05/2008 23:06 44.059 harupdf.ch
0/10/2012 17:53 35.840 hbhpdf.lib
9/05/2012 17:10 4.187 hbzebra.ch
0/10/2012 17:53 53.248 hbzebra.lib
8/05/2011 17:42 692.736 libharu.lib
0/10/2012 17:52 153.088 png.lib
echo %hdirl%\hbhpdf.lib + >> b32.bc
echo %hdirl%\libharu.lib + >> b32.bc
echo %hdirl%\png.lib + >> b32.bc
Func _ReqPrint1( nView,oDlg,oSay,cSay,oRsTrav, cToPdf, lIsRunning ) // cToPrf
REQUEST FWHARU
Local oPrint
Local oFont8,oFont8b,oFont10,oFont10b,ofont12ib,oFont12b,oFOnt14,oFont24b,oFont10d,oFont10i
Local oPen1,nLines,nPages,nMargin,nPage
Local nRowStep,nColStep
Local cHead1,cHead2,cText,yText,nPrice
Local xLine,nLinCnt,i
Local dDate
Local cTrainTp1,cTrainTp2,cTrainTp3,cTrainTp4,cTrainTp5,cTrainTp6
Do Case
Case nVIEW = 1
PRINTER oPRINT FROM USER ;
PREVIEW MODAL ;
NAME "Request Print Routine "+xLOGIN
IF EMPTY( oPRINT:hDC )
MsgStop ( "Printer not Ready !" )
CLOSE DATABASES
oDlg:END()
RETURN(NIL)
ENDIF
Case nVIEW = 2
PRINTER oPRINT from USER ;
NAME "Gross Sales Summary Report for "+xLOGIN
IF EMPTY( oPRINT:hDC )
MsgStop ( "Printer not Ready !" )
CLOSE DATABASES
oDlg:END()
RETURN(NIL)
ENDIF
Case nVIEW = 3
TPrinter():lUseHaruPDF := .t.
PRINT to oPrint FILE "C:\dbtmp\Rick.pdf"
// create request.pdf, export all documents and create e-mail
EndCase
oFont8 := TFont():New( "Times New Roman", 0,-8, .F.,.F. , , , ,.F.,,,,,,, oPRINT, )
oFont8b := TFont():New( "Times New Roman", 0,-8, .F.,.T. , , , ,.F.,,,,,,, oPRINT, )
oFont10 := TFont():New( "Arial", 0,-9, .F.,.F. , , , ,.F.,,,,,,, oPRINT, ) //-10
oFont10b := TFont():New( "Times New Roman", 0,-10,.F.,.T. , , , ,.F.,,,,,,, oPRINT, )
oFont10i := TFont():New( "Times New Roman", 0,-10,.F.,.T. , , , ,.T.,,,,,,, oPRINT, )
oFont12ib := TFont():New( "Times New Roman", 0,-12,.F.,.T. , , , ,.T.,,,,,,, oPRINT, )
oFont12b := TFont():New( "Times New Roman", 0,-12,.F.,.T. , , , ,.F.,,,,,,, oPRINT, )
oFont14b := TFont():New( "Times New Roman", 0,-14,.F.,.T. , , , ,.F.,,,,,,, oPRINT, )
oFont24b := TFont():New( "Times New Roman", 0,-24,.F.,.T. , , , ,.F.,,,,,,, oPRINT, )
oFont10d := TFont():New( "Courier New", 0,-10,.F.,.T. , , , ,.F.,,,,,,, oPRINT, )
DEFINE PEN oPen1 WIDTH 1 // 5 //10
cSay := "Generating Output"
oSay:ReFresh()
SysReFresh()
SysWait(1) // take out later
lIsRunning := .t. // cancel trap
nLines := 0
nPages := 1
Do Case
Case nView = 1 .or. nView = 2
nRowStep := oPrint:nVertRes() / 55 // pixel per line = 57.65 @ 55
nColStep := oPrint:nHorzRes() /130 // columns
Case nView = 3
nRowStep := 56.66 // to pdf
nColStep := 39.33
Otherwise
nRowStep := oPrint:nVertRes() / 55 // pixel per line = 57.65 @ 55
nColStep := oPrint:nHorzRes() /130 // columns
EndCase
oPRINT:StartPage() // error here <<<----------------------------------
nMargin := Int(oPrint:nLogPixelX()*0.2)
LINE := nMargin
nPage := 1
cHead1 := "State of South Carolina Department of Insurance"
cHead2 := "Travel / Training Request Form"
oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.25), cHead1, oFONT14b )
Line += oFont12b:nHeight
oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.34), cHead2, oFONT14b )
Line += oFont12b:nHeight
Line += oFont12b:nHeight
oPrint:Line( line, (oPrint:nHorzRes()*.02 ), line, (oPrint:nHorzRes()*.9792), oPen1 ) // top line
Line += oFont12b:nHeight
cText := "Is this Associated with a"
oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.02), cText, oFONT10 )
cText := If(empty(oRsTrav:Fields("PrevAppr"):Value)," ",oRsTrav:Fields("PrevAppr"):Value )
oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.21), cText, oFONT10b )
Line += oFont10b:nHeight
cText := "Previously approved"
oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.02), cText, oFONT10 )
Line += oFont10b:nHeight
cText := "Designation (Y/N)"
oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.02), cText, oFONT10 )
*oPrint:Box( line, (oPrint:nHorzRes()* .20 ), Line* .77, (oPrint:nHorzRes()*.23 ), oPen1 ) // associaed with
Line -= oFont14b:nHeight+5
Line -= oFont8b:nHeight-12
cText := "If Yes, Please list"
oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.25), cText, oFONT10 )
Line += oFont10b:nHeight
cText := "Designation"
oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.25), cText, oFONT10 )
Line += oFont10b:nHeight
cText := "( 200 char )"
oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.25), cText, oFONT10 )
Line -= oFont14b:nHeight+22
oPrint:Box( line, (oPrint:nHorzRes()* .38 ), Line* 1.70, (oPrint:nHorzRes()*.81 ), oPen1 ) // designation box
xLine := Line
cText := oRsTrav:Fields("Design"):Value
If Empty(cText) .or. cText = " "
Else
Line += oFont8:nHeight-10
cText := Alltrim( cText)
nLinCnt := MlCount( cText, 75 )
IF nLinCnt > 0
For x := 1 to nLinCnt
yText := MemoLine( cText, 75, x )
oPRINT:SAY ( LINE, (oPrint:nHorzRes()*.39 ), yText, oFONT8 )
Line += oFont8:nHeight
Next
Endif
Endif
Line := xLine
...
...
...
....
oPRINT:StartPage() // error here <<<----------------------------------
PAGE
....
ENDPAGE
oPRINT:EndPage()
Do Case
Case nView = 1 // view
oPRINT:Preview()
Case nView = 2
PrintEnd()
Case nView = 3
* PrintEnd()
PRINT to oPrint FILE "C:\dbtmp\Rick.pdf" // tried this and it did not work
EndCase
Do Case
Case nVIEW = 1
PRINTER oPRINT FROM USER ;
PREVIEW MODAL ;
NAME "Request Print Routine "+xLOGIN
IF EMPTY( oPRINT:hDC )
MsgStop ( "Printer not Ready !" )
CLOSE DATABASES
oDlg:END()
RETURN(NIL)
ENDIF
Case nVIEW = 2
PRINTER oPRINT from USER ;
NAME "Request Print Routine for "+xLOGIN
IF EMPTY( oPRINT:hDC )
MsgStop ( "Printer not Ready !" )
CLOSE DATABASES
oDlg:END()
RETURN(NIL)
ENDIF
Case nVIEW = 3
TPrinter():lUseHaruPDF := .t.
PRINTER oPRINT ; //from USER ;
NAME "Request Print Routine for "+xLogin
IF EMPTY( oPRINT:hDC )
MsgStop ( "Printer not Ready !" )
RETURN(.f.)
ENDIF
* TPrinter():lUseHaruPDF := .t.
* PRINT to oPrint FILE "C:\dbtmp\Rick.pdf"
// create request.pdf, export all documents and create e-mail
EndCase
Application
===========
Path and name: C:\DLYMA\dlyma.exe (32 bits)
Size: 7,460,864 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20190613)
FiveWin version: FWH 19.09
C compiler version: Borland/Embarcadero C++ 7.3 (32-bit)
Windows version: 6.2, Build 9200
Time from start: 0 hours 1 mins 6 secs
Error occurred at: 05/10/2020, 10:21:45
Error description: Warning BASE/1004 Message not found: FWPDF:SETCOPIES
Stack Calls
===========
Called from: source\rtl\tobject.prg => FWPDF:ERROR( 0 )
Called from: source\rtl\tobject.prg => FWPDF:MSGNOTFOUND( 0 )
Called from: source\rtl\tobject.prg => FWPDF:SETCOPIES( 0 )
Called from: .\source\classes\ESREPORT.PRG => FW_EREPORT:NEW( 358 )
Called from: c:\dlyma\prg\Afact.prg => CFACT:IMPRIMEFACT( 698 )
Called from: c:\dlyma\prg\R32_fact.prg => ENVIARCLI( 4804 )
Called from: c:\dlyma\prg\R32_fact.prg => (b)AVANCECLI( 4720 )
Called from: .\source\classes\BUTTON.PRG => TBUTTONBMP:CLICK( 179 )
Called from: .\source\classes\CONTROL.PRG => TBUTTON:HANDLEEVENT( 1755 )
Called from: .\source\classes\BUTTONB.PRG => TBUTTONBMP:HANDLEEVENT( 261 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3559 )
Called from: => SENDMESSAGE( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:COMMAND( 433 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 1136 )
Called from: => DIALOGBOXW( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 304 )
Called from: c:\dlyma\prg\R32_fact.prg => AVANCECLI( 4726 )
Called from: c:\dlyma\prg\R32_fact.prg => (b)FFACTURAS( 93 )
Called from: c:\dlyma\prg\R32_fact.prg => (b)FFACTURAS( 235 )
Called from: .\source\classes\URLLINK.PRG => TURLLINK:LBUTTONDOWN( 180 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1788 )
Called from: .\source\classes\URLLINK.PRG => TURLLINK:HANDLEEVENT( 168 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3559 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1097 )
Called from: c:\dlyma\prg\R32_menu.prg => VTNAPRINCIPAL( 497 )
Called from: c:\dlyma\prg\R32_menu.prg => MAIN( 86 )
....
TPrinter():lUseHaruPDF := .t.
.....
.....
EASYREPORT oVRD NAME ::hOtros["rutavrd"] TO ::cPreterminada PREVIEW (.F.) FILE cNombrePDF
.....
// C:\FWH...\SAMPLES\DAMIANO.PRG
#Include "FiveWin.ch"
FUNCTION Main()
LOCAL cComeFrom := "With preview"
// oPrn:SetCopies( nCopie ) // Does not work
LOCAL nCopie := 3
nSetCopies( nCopie, cComeFrom ) // nCopies
RETURN NIL
FUNCTION nSetCopies( nCopie, cComeFrom )
LOCAL nI
FOR nI := 1 TO nCopie
MsgRun( "PREVIEW. WAIT...", ;
"Wait a Moment... ", ;
{ || CursorWait(), WinExec( Imp_Damiano( cComeFrom ) ), 3 } )
NEXT
RETURN NIL
FUNCTION Imp_Damiano( cComeFrom )
LOCAL aPrn, oPrn, oFont, oFont2, oFont3, m_Get := ARRAY(5)
LOCAL nRowStep, nColStep
m_Get[01] := DTOC( DATE() )
aPrn := GetPrinters()
IF Empty( aPrn )
RETURN NIL
ENDIF
PRINTER oPrn PREVIEW MODAL
IF EMPTY( oPrn:hDC )
oPrn:End()
RETURN( .F. )
ENDIF
oPrn:End()
IF cComeFrom = "Directtoprinter"
PRINT oPrn NAME "Cartellino finiti" // Direct to the printer
ELSEIF cComeFrom = "With preview"
PRINT oPrn NAME "Cartellino finiti" PREVIEW MODAL // With preview
ELSEIF cComeFrom = "GeneratePDF"
PRINT oPrn PREVIEW // Generate PDF
ENDIF
DEFINE FONT oFont NAME "Bahnschrift Light Condensed" SIZE 0, - 18 BOLD OF oPrn
DEFINE FONT oFont2 NAME "Bahnschrift Light Condensed" SIZE 0, - 26 BOLD OF oPrn
DEFINE FONT oFont3 NAME "Bahnschrift Light Condensed" SIZE 0, - 20 BOLD OF oPrn
nRowStep = oPrn:nVertRes() / 40 // 56 righe
nColStep = oPrn:nHorzRes() / 80 // 170 colonne
PAGE
// oPrn:Say( nRowStep * 2, nColStep * 65, Transform( m_Get[01],"@D 99/99/9999" ), oFont3 ) //Data
oPrn:Say( nRowStep * 2, nColStep * 65, TRANSF( m_Get[01],"@D 99/99/9999" ), oFont3 ) //Data
ENDPAGE
ENDPRINT
IF cComeFrom = "GeneratePDF"
FWSavePreviewToPDF( oPrn, "Cartellino.pdf", .F. )
ENDIF
oFont:End()
oFont2:End()
oFont3:End()
RETURN NIL
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 50 guests