Thank you for your lib advice .. I am able to compile without any issues .. Looking at the sample programs PdfHaru1 and PdfHaru2 .. I see no way I can adapt my code to FWHaru .. The report I am trying to print to pdf works fine if you use the print viewer .. however, I am doing a lot in this report by using the Printer oPrint:nVertRes() and oPrint:nHorzRes() properties and placing my text on the page in relatively the same position based on what ever printer is used ..
I just do not know where to start to retrofit this code to create a FWHARU pdf .. here is a small snipit of code
Code: Select all
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
...
...
...
....
This code works fine if you send the output to the previewer ( rpreview.prg ) and select the Adobe icon .. I was hoping to create this form silently and send it to file as a Pdf .. Any ideas ?? FWHARU sounds like a Great option if I can get it to work ..