Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enumerating custom paper sizes

Status
Not open for further replies.

alanmusician

Programmer
Jun 30, 2005
17
US
I am trying to get a list of custom paper sizes to populate a combobox. So far I have the list for the selected printer, but it doesn't include custom paper sizes. Instead, at the end of the list it has an item named "Custom..." with a RawKind of 256.

Code:
            List<PaperSize> paperSizes = new List<PaperSize>();
            foreach (PaperSize paperSize in testDocument.PrinterSettings.PaperSizes)
            {
                if (paperSize.Kind != PaperKind.Custom)
                {
                    paperSizes.Add(paperSize);
                }
            }

Above is the code that I am using. Where else do I need to look for the paper sizes?
 
Oops. The issue was that a printer was not being selected when I first pulled the list, so my paper types didn't show up.
Once I fixed that, I thought I was filtering for the "Custom Paper Size..." entry only, when I was filtering all custom sizes. Duh!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top