Posted by a ceTe Software moderator
Hello,
The PrintManager API provides two different classes to programmatically set the paper source based on the page size, at the PrintJob level you can use
PrintJobPrintOptions and set the PaperSource property based on the PaperSize. You can also do this at the PrintJobPage level by using
PrintJobPagePrintOptions.
Below sample code demonstrates how to use the print options at page level, you can do the same with the PrintJob level options which will be applicable to the whole document.
PrintJob printJob = new PrintJob(Printer.Default, @"C:\MyDocument.pdf", 1, 4);
// Get the last page and set its print options
PrintJobPage printJobPage = printJob.Pages[printJob.Pages.Count - 1];
PrintJobPagePrintOptions pagePrintOptions = printJobPage.PrintOptions;
pagePrintOptions.Inherit = false;
// set the papersource based on the papersize.
if(pagePrintOptions.PaperSize.Name == "Letter")
pagePrintOptions.PaperSource = Printer.Default.PaperSources[2];
printJob.Print();
Thanks,
ceTe Software Support Team