Stoffel85
Newcomer
Hi,
I found a nice tutorial about printing multiple pages in VB.NET ( http://www.startvbdotnet.com/controls/printdialog.aspx ).
But I can't figure it out.
I have different strings that need to be printed. So do I need to do that MeasureString for every string I have?
And another thing, I would like to check if a string fits on the page, if not print it on the other page, don't interupt it like in this example
Is there also a way to count how many pages I would have because I would like to have an header and footer on every page and in the footer current page / total pages
Is there another way to do this? (easier?)
Thanks in advance
I found a nice tutorial about printing multiple pages in VB.NET ( http://www.startvbdotnet.com/controls/printdialog.aspx ).
But I can't figure it out.
Visual Basic:
...
e.Graphics.MeasureString(Mid(RichTextBox1.Text, intCurrentChar + 1), font,_
New SizeF(PrintAreaWidth, PrintAreaHeight), fmt, intCharsFitted, intLinesFilled)
' calling MeasureString to determine the number of characters that will fit in
' the printing area rectangle
e.Graphics.DrawString(Mid(RichTextBox1.Text, intCurrentChar + 1), font,_
Brushes.Black, rectPrintingArea, fmt)
' print the text to the page
intCurrentChar += intCharsFitted
'advancing the current char to the last char printed on this page
If intCurrentChar < RichTextBox1.Text.Length Then
e.HasMorePages = True
'HasMorePages tells the printing module whether another PrintPage event should be fired
Else
e.HasMorePages = False
intCurrentChar = 0
End If
I have different strings that need to be printed. So do I need to do that MeasureString for every string I have?
And another thing, I would like to check if a string fits on the page, if not print it on the other page, don't interupt it like in this example
Is there also a way to count how many pages I would have because I would like to have an header and footer on every page and in the footer current page / total pages
Is there another way to do this? (easier?)
Thanks in advance
Last edited: