Hi Tim,
Thanks for your inquiry. The following code shows how to set up printing using different printer trays for different paper sizes.
Document doc = new Document();
// Choose the default printer to be used for printing
this document.
System.Drawing.Printing.PrinterSettings settings = new System.Drawing.Printing.PrinterSettings();
// This is the tray we will use for A4 paper size.
This is the first tray in the paper sources collection.
int printerTrayForA4 = settings.PaperSources[0].RawKind;
// The is the tray we will use for Letter paper size.
This is the second tray in the paper sources collection.
int printerTrayForLetter = settings.PaperSources[1].RawKind;
// Set the page tray used for each section based off
the paper size used in the section.
foreach (Section section in doc.Sections)
{
if (section.PageSetup.PaperSize == PaperSize.Letter)
{
section.PageSetup.FirstPageTray = printerTrayForLetter;
section.PageSetup.OtherPagesTray = printerTrayForLetter;
}
else if (section.PageSetup.PaperSize == PaperSize.A4)
{
section.PageSetup.FirstPageTray = printerTrayForA4;
section.PageSetup.OtherPagesTray = printerTrayForA4;
}
}
I hope, this helps.
Best regards,