public void DefaultPaperTray()
{
//ExStart
//ExFor:PageSetup.FirstPageTray
//ExFor:PageSetup.OtherPagesTray
//ExSummary:Changes all sections in a document to use the default paper tray of the selected printer.
Document doc = new Document();
// Find the printer that will be used for printing this document. In this case it is the default printer.
// You can define a specific printer using PrinterName.
PrinterSettings settings = new PrinterSettings();
// The paper tray value stored in documents is completely printer specific. This means
// The code below resets all page tray values to use the current printers default tray.
// You can enumerate PrinterSettings.PaperSources to find the other valid paper tray values of the selected printer.
foreach (Section section in doc.Sections)
{
section.PageSetup.FirstPageTray = settings.DefaultPageSettings.PaperSource.RawKind;
section.PageSetup.OtherPagesTray = settings.DefaultPageSettings.PaperSource.RawKind;
}
//ExEnd
}