Private Sub PrintDocument3_PrintPage(sender As Object, e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument3.PrintPage

        Dim PrintFont As New Font("Arial", 18)
        Dim LineHeight As Single = PrintFont.GetHeight + 2
        Dim Horizontal As Single = 100
        Dim Vertical As Single = e.MarginBounds.Top
        Dim PrintLine As String = "This is a Chapter 4 Testing"

        Static pageCount As Integer = 1

        e.Graphics.DrawString("Page" & pageCount.ToString(), PrintFont, Brushes.Blue, 600, Vertical)
        Vertical += LineHeight * 2

            'Assume This Have 40 Copies
            e.Graphics.DrawString(PrintLine, PrintFont, Brushes.Blue, Horizontal, Vertical)
            Vertical += LineHeight

            If Vertical >= e.MarginBounds.Bottom Then
                pageCount += 1
                e.HasMorePages = True
                e.HasMorePages = False
            End If

        Loop Until e.HasMorePages = False

    End Sub

i would like to ask how can i add more page when the e.Graphics.DrawString has reach e.MarginBound.Bottom?
The code above is what i've tried.

Ya i know the way to do it,
but i want the printing data is based on my database,
so i am wondering how to add more page and increase the page number once the e.MarginBound.Bottom = true?

Edited 4 Years Ago by gahhon

This question has already been answered. Start a new discussion instead.