' Gambas class file
Static Public iCkNumber As Integer
Static Public ibankroute As String
Static Public iaccountNumber As String
Static Public iStartCkNum As Integer = 25000
Public Sub Form_Open()
End
Public Sub Prn1_Draw()
Dim ix, inumpages As Integer
Dim mircnumber As String
Dim iCkNumber As Integer
iCkNumber = iStartCkNum
For inumpages = 1 To 3
iStartCkNum += 3
For ix = 0 To 400 Step 200
Paint.Font = Font["Aeral, 12, bold "]
Paint.DrawRichText(iCkNumber, 480, 25 + ix)
Paint.Font = Font["Aeral,9"]
Paint.DrawrichText("<b>John Doe JR.</b><br> 1234 Main Sr. <br>Hometown Il 66152", 210, 35 + ix)
Paint.DrawrichText("<u>Date______________________ </u>", 390, 65 + ix)
Paint.DrawrichText("<small>Pay to the<br><u>order of:</u></small><u>_______________________________________________________________|</u>", 190, 80 + ix)
Paint.DrawrichText("<h3>$<u>________________</u></h3> ", 472, 88 + ix)
Paint.DrawrichText("<u>______________________________________________________________________________<small>Dollars</small></u>", 190, 120 + ix)
Paint.Font = Font["MICR Encoding,18"]
mircnumber = Str("a7200012345a c8543987c") & Str(iCkNumber)
Paint.DrawRichText(mircnumber, 197, 200 + ix)
Inc iCkNumber
Next 'ix
' need page feed here
Next
End
Public Sub Button1_Click()
If Prn1.Configure() Then Return
Prn1.Print()
End
How can I insert a pagefeed or newpage in this
- grayghost4
- Posts: 187
- Joined: Wednesday 5th December 2018 5:00am
- Location: Marengo, Illinois usa
How can I insert a pagefeed or newpage in this
I need a Page feed or new page at the comment below ... at line 37
Re: How can I insert a pagefeed or newpage in this
Try by using gb.pdf
- grayghost4
- Posts: 187
- Joined: Wednesday 5th December 2018 5:00am
- Location: Marengo, Illinois usa
Re: How can I insert a pagefeed or newpage in this
Sorry! I am on the beach in Gran Canaria
Take a look at the farm. Should be an example there.
Take a look at the farm. Should be an example there.
- grayghost4
- Posts: 187
- Joined: Wednesday 5th December 2018 5:00am
- Location: Marengo, Illinois usa
Re: How can I insert a pagefeed or newpage in this
I still have not found a "new page" command ... but have rewritten the routine to accomplish the same results
It would be nice to learn how to implement a page brake.
In the meantime I have a lot to learn about Gambas.
It would be nice to learn how to implement a page brake.
In the meantime I have a lot to learn about Gambas.
Re: How can I insert a pagefeed or newpage in this
I don't think you need a page-break for a modern printer.grayghost4 wrote: ↑Wednesday 1st January 2020 7:53am ...It would be nice to learn how to implement a page brake...
The key to this is that the printer prints on a new page every time you tell it to print (i.e. via the Printer_Draw event). So to print several pages, use Printer.Count & Printer.Page to control your program so that the Printer_Draw() event fires for each page that you require.
Unfortunately I'm having all sorts of Gambas printer problems, but these are not really related to your question. However, take a look at this test code (which uses Paint.DrawText because of my problems):-
Public SimpleText_p1 As String
Public SimpleText_p2 As String
Public Sub Form_Open()
pr1.Count = 2 'number of pages to print
SimpleText_p1 = "HELLO!" & Chr(10) & "Intro: This book describes all I know about printing."
SimpleText_p2 = "That's it!" & Chr(10) & "goodbye!"
End
Public Sub pr1_Draw()
Dim strText As String
Paint.Font = Font["Liberation Serif,12"]
Paint.Color(Color.Black)
Select Case pr1.Page 'which page are we printing this time?
Case 1
strText = SimpleText_p1
Case 2
strText = SimpleText_p2
Case Else
strText = "...what just happened?"
End Select
Paint.DrawText("Page number: " & pr1.Page & Chr(10) & strText, 50, 50)
Paint.Fill
Catch
lblErrors.Text = Error.Text
End
Public Sub bPrintPlain_Click()
If pr1.Configure() Then Return 'if user clicks Cancel, don't continue
pr1.Print
Catch
lblErrors.Text = Error.Text
End
This works except it prints blank pages the 1st time I press the button, but then it prints both pages on subsequent presses OK. I hope this at least gives you the idea that you print pages based upon page count & number.
Last edited by stevedee on Wednesday 1st January 2020 5:10pm, edited 3 times in total.
Re: How can I insert a pagefeed or newpage in this
Its a great book, but it doesn't deal with pagination.
Key comments in the Gambas Documentation include: http://gambaswiki.org/wiki/comp/gb.qt4/printer/.begin
- grayghost4
- Posts: 187
- Joined: Wednesday 5th December 2018 5:00am
- Location: Marengo, Illinois usa
Re: How can I insert a pagefeed or newpage in this
stevedee:
Thanks for the listing you put up... Got it working with :
Printer1.Count = inumofpages
That works kinda like a For Next loop
and in my case I don't need paint.fill
Thanks for the listing you put up... Got it working with :
Printer1.Count = inumofpages
That works kinda like a For Next loop
and in my case I don't need paint.fill