Code: Select all
oPrn:say(nRow,nCol,cText,oFont,,,,1)
oPrn:say(nRow,nCol,cText,oFont,,,,2)
Code: Select all
DATA nXoffset INIT 0
DATA nYoffset INIT 0
Code: Select all
oPrn:say(nRow,nCol,cText,oFont,,,,1)
oPrn:say(nRow,nCol,cText,oFont,,,,2)
Code: Select all
DATA nXoffset INIT 0
DATA nYoffset INIT 0
Code: Select all
....
DEFAULT nWidth := 0
....
DO CASE
CASE nPad == NIL .OR. nPad == HPDF_TALIGN_LEFT //.OR. Empty( nWidth ) //removed
....
Code: Select all
#include "fivewin.ch"
#include "report.ch"
REQUEST FWHARU
function Main()
local oPrn, oFont, oPen
local cPdfFile
TPrinter():lUseHaruPDF := .t.
cPdfFile := "test.pdf"
PRINT oPrn PREVIEW FILE cPdfFile
DEFINE FONT oFont NAME "ARIAL" SIZE 0,-20 OF oPrn
DEFINE PEN oPen WIDTH 1 OF oPrn
PAGE
oPrn:RoundBox( 3, 2.5, 9, 12.5, 1, 1, oPen, CLR_YELLOW, nil, "CM" )
oPrn:Say( 4, 2.5, "Left at 4 cm", oFont, 10, nil, nil, 0, "CM" )
oPrn:Say( 5, 2.5, "Right at 5 cm", oFont, 10, nil, nil, 1, "CM" )
oPrn:Say( 6, 2.5, "Centered at 6 cm", oFont, 10, nil, nil, 2, "CM" )
oPrn:Say( 3, 0.984, "Left at 3 inches", oFont, 10, nil, nil, 0, "INCHES" )
ENDPAGE
ENDPRINT
RELEASE FONT oFont
RELEASE PEN oPen
return nil
Code: Select all
cPdfFile := "test.pdf"
Code: Select all
oPrn:RoundBox( 3, 2.5, 9, 12.5, 1, 1, oPen, CLR_YELLOW, nil, "CM" )
oPrn:Say( 4, 2.5, "Left at 4 cm", oFont, , nil, nil, 0, "CM" )
oPrn:Say( 5, 2.5, "Right at 5 cm", oFont, , nil, nil, 1, "CM" )
oPrn:Say( 6, 2.5, "Centered at 6 cm", oFont, , nil, nil, 2, "CM" )
oPrn:Say( 3, 0.984, "Left at 3 inches", oFont, , nil, nil, 0, "INCHES" )
nWidth is respected.byte-one wrote:As workaround in fwpdf.prg i make this correction:and now is functioning.Code: Select all
.... DEFAULT nWidth := 0 .... DO CASE CASE nPad == NIL .OR. nPad == HPDF_TALIGN_LEFT //.OR. Empty( nWidth ) //removed ....
But this is not correct code, as nWidth is not respected as in printer.prg!!!!
We recommend using oPrn:PrintImage(...) introduced in FWH1510 and enhanced in FWH1604 for all future developments.To add oPrn:Sayimage(…) as this is better quality as oPrn:Saybitmap(...)
Code: Select all
METHOD PrintImage( nRow, nCol, uImage, nWidth, nHeight, lStretch, nAlpha, lTransp, lGray, cUnits, cAlign, cURL )
Code: Select all
#xcommand @ <nRow>, <nCol> PRINT TO <prn> IMAGE <img> ;
[SIZE <nWidth> [,<nHeight>] ] ;
[<unit: PIXEL,MM,CM,INCHES,SCREEN>] ; // do not use PIXEL/SCREEN
[<lStr: STRETCH>] ;
[ ALPHALEVEL <nAlpha>] ; // ignored by fwpdf
[<lNoTrn: NOTRANSPARENT>] ; // ignored by fwpdf
[<lGray: GRAY> ] ; // ignored by fwpdf
[ALIGN <aln>] ;
[URL <cURL> ] ; // ignored by TPrinter
[LASTROW <lrow>] ;
=> ;
[<lrow> := ] <prn>:PrintImage( <nRow>, <nCol>, <img>, [<nWidth>], [<nHeight>], ;
[<.lStr.>], [<nAlpha>], [!<.lNoTrn.>], [<.lGray.>], [<(unit)>], [<aln>], [<cURL>] )
May we know why these DATA are necessary. All methods are working without any errors without these DATAsTo add in Tpdf:
Code:
DATA nXoffset INIT 0
DATA nYoffset INIT 0
Code: Select all
#include "fivewin.ch"
#include "report.ch"
REQUEST FWHARU
function Main()
local oPrn, oFont, oPen, nWidth
local cPdfFile
TPrinter():lUseHaruPDF := .t.
if MsgYesNo( "Output to PDF?" )
cPdfFile := "test.pdf"
endif
PRINT oPrn PREVIEW FILE cPdfFile
DEFINE FONT oFont NAME "ARIAL" SIZE 0,-14 BOLD OF oPrn
DEFINE PEN oPen WIDTH 1 OF oPrn
PAGE
nWidth := 14
oPrn:Say( 1, 3, If( cPdfFile == nil, "TPrinter", "FWPdf" ), oFont, nil, nil, nil, 0, "CM" )
oPrn:Say( 2, 3, "Method Say() with nWidth param = 14 cm", oFont, nil, nil, nil, 0, "CM" )
oPrn:RoundBox( 3, 3, 7, 17, 1, 1, oPen, CLR_YELLOW, nil, "CM" )
oPrn:Say( 4, 3, "LEFT ALIGNED TEXT WIDTH 14 CM", oFont, nWidth, nil, nil, 0, "CM" )
oPrn:Say( 5, 3, "RIGHT ALIGNED TEXT WIDTH 14 CM", oFont, nWidth, nil, nil, 1, "CM" )
oPrn:Say( 6, 3, "CENTERED TEXT WIDTH 14 CM", oFont, nWidth, nil, nil, 2, "CM" )
nWidth := nil
oPrn:Say( 8, 3, "Method Say() with nWidth param = nil" + ;
If( cPdfFile == nil, "", " : FWPdf ignores Alignment" ), oFont, nil, nil, nil, 0, "CM" )
oPrn:RoundBox( 9, 3, 13, 17, 1, 1, oPen, CLR_YELLOW, nil, "CM" )
oPrn:Say( 10, 3, "LEFT ALIGNED TEXT WIDTH NIL", oFont, nWidth, nil, nil, 0, "CM" )
oPrn:Say( 11, 3, "RIGHT ALIGNED TEXT WIDTH NIL", oFont, nWidth, nil, nil, 1, "CM" )
oPrn:Say( 12, 3, "CENTERED TEXT WIDTH NIL", oFont, nWidth, nil, nil, 2, "CM" )
if cPdfFile == nil
oPrn:Say( 15, 3, "LEFT Align: Prints text to the RIGHT of nCol", oFont, nil, nil, nil, 0, "CM" )
oPrn:Say( 16, 3, "RIGHT Align: Prints text to the LEFT of nCol", oFont, nil, nil, nil, 0, "CM" )
oPrn:Say( 17, 3, "CENTER Align: Prints text CENTERED around nCol", oFont, nil, nil, nil, 0, "CM" )
endif
oPrn:RoundBox( 18, 3, 22, 17, 1, 1, oPen, CLR_YELLOW, nil, "CM" )
oPrn:Say( 19, 3, "LEFT", oFont, nWidth, nil, nil, 0, "CM" )
oPrn:Say( 20, 3, "RIGHT", oFont, nWidth, nil, nil, 1, "CM" )
oPrn:Say( 21, 3, "CENTER", oFont, nWidth, nil, nil, 2, "CM" )
ENDPAGE
ENDPRINT
RELEASE FONT oFont
RELEASE PEN oPen
return nil
Code: Select all
if empty(nWidth)
....LEFT
....Right
...center
else //nWidth are NOT empty
....same as now in fwpdf only
endif
For Tprinter it is nessacary to use this for check the first pixel the printer are able to print. These datas are only required for compatibility from code.To add in Tpdf:
Code:
DATA nXoffset INIT 0
DATA nYoffset INIT 0