Smit
Smit

Reputation: 21

How to adjust the paper size in vb.net

i have the following code to print the page, i want to add custom page size how do i do that?

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

    PrintDialog1.AllowSomePages = True
    PrintDialog1.ShowHelp = True
    PrintDialog1.Document = docToPrint
    Dim result As DialogResult = PrintDialog1.ShowDialog()
    If (result = DialogResult.OK) Then
        docToPrint.Print()
    End If

End Sub

Upvotes: 0

Views: 12966

Answers (1)

Rajnikant Sharma
Rajnikant Sharma

Reputation: 606

You can set the paper size using DefaultPageSettings.PaperSize properties of document Example:

Dim xCustomSize As New PaperSize("Legal", 850, 1400)

Me.DefaultPageSettings.PaperSize = xCustomSize

Fine more information here

Upvotes: 1

Related Questions