Paperbin/Papersize list from a selected printer

Example requests & Code samples for GdPicture Toolkits.
Post Reply
SIIYM
Posts: 3
Joined: Tue Nov 10, 2009 11:50 am

Paperbin/Papersize list from a selected printer

Post by SIIYM » Tue Nov 10, 2009 12:06 pm

Hi,

I didn't found the way to get from a selected printer a list with all their paper bins or paper sizes. Is this feature planned ?

Thanks,
Yann.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Paperbin/Papersize list from a selected printer

Post by Loïc » Tue Nov 10, 2009 12:19 pm

Hi Yann,

.NET framework already offers a lot of functions to do that.


Here is a vb.net sample: Start a new project, add button1 & Button2.
Button1 will list all paper bin & Button 2 will list all paper sizes:


Code: Select all

Public Class Form1

    Private prn As New Printing.PrintDocument

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        For n As Integer = 0 To prn.DefaultPageSettings.PrinterSettings.PaperSources.Count - 1
            MsgBox(prn.DefaultPageSettings.PrinterSettings.PaperSources(n).ToString)
        Next
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        For n As Integer = 0 To prn.DefaultPageSettings.PrinterSettings.PaperSizes.Count - 1
            MsgBox(prn.DefaultPageSettings.PrinterSettings.PaperSizes(n).ToString)
        Next
    End Sub
End Class
Hope this helps.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests