Is there a way to find all print trays on a printer and get their paper sizes e.g.
Tray1 = A4
Tray2 = A3
Tray3 = Letter
I can see a way to get the Trays using something like this but it doesn’t seem to have the paper size information.
using (System.Drawing.Printing.PrintDocument doc = new PrintDocument())
{
foreach (System.Drawing.Printing.PaperSource paperSource in doc.PrinterSettings.PaperSources)
{
string trayName = paperSource.SourceName;
}
}
What I am wanting to do is select the best Tray for the print job by default.
You can get the printer properties which includes the paper bins (trays) for the printer using windows api:
http://msdn.microsoft.com/en-us/library/bb258176(v=office.12).aspx
http://www.thedbcommunity.com/index.php?option=com_content&task=view&id=218&Itemid=56
You could use the IPaper class in ArcObjects SDK 10 Microsoft.NET Framework (I am not quite sure about how this works)
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//0001000002wn000000
Edit: Just took an in depth look on one of the links I gave you, this should be the answer you’re looking for:
Copied partly from the website due to restrictions, you can view the full code here:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=3687&lngWId=10