printing on portrait or landscape paper
Posted: Tue May 28, 2019 6:16 pm
Hello,
While printing we can set the oriantation of the paper to portrait or landscape. But the number of rows we can print stay the same, Look at this sample. As you change oPrn:SetPagOrientation(0) to oPrn:SetPagOrientation(1) there are still 37 lines on the paper, but the spacing between the lines is smaller. Also the code to print the pagenumber does not work.
Can we change the number of lines that are printed on the paper OR change the spacing between the lines.
While printing we can set the oriantation of the paper to portrait or landscape. But the number of rows we can print stay the same, Look at this sample. As you change oPrn:SetPagOrientation(0) to oPrn:SetPagOrientation(1) there are still 37 lines on the paper, but the spacing between the lines is smaller. Also the code to print the pagenumber does not work.
Code: Select all
FUNCTION RK_TestPrint()
LOCAL nPage := 1
LOCAL nCol := 28 && the column we start printing
LOCAL nRow := 1 && the row we start printing
LOCAL cText := ''
LOCAL oPrn:=TPrinter():new(0,0,0,0)
oPrn:SetLeftMargin(0)
oPrn:SetRightMargin(0)
oPrn:SetTopMargin(0)
oPrn:SetbottomMargin(0)
oPrn:setPaperName("A4")
*oPrn:AutoPage(.T.)
oPrn:SetPagOrientation(0)
oPrn:StartPage()
FOR n = 1 TO 100
cText := 'This is line: ' + ALLTRIM(STR(nRow))
@ nRow, 28 SAY oSay PROMPT cText OF oPrn PAGINED SIZE 300, 20
oSay:Setfont(Arial,12 )
nRow++
IF nRow > oPrn:LastRow()-2
@ oPrn:LastRow(), 450 SAY oSay PROMPT 'page ' + ALLTRIM(STR(nPage)) OF oPrn PAGINED SIZE 300, 20
oSay:Setfont(Arial,12 )
nPage++
nRow := 1
oPrn:EndPage()
oPrn:StartPage()
ENDIF
NEXT
oPrn:EndPage()
oPrn:run()
RETURN NIL