Posted by a ceTe Software moderator
Hello,
You can set the paper source to the print job using the paper source name. You will need to use the SetPaperSourceByName method of PrintOptions class to do this. Also you can use the PaprerSource class and PaperSources enumerator to set the paper source for the printjob. Below is the sample code for it.
Method 1: Setting paper source using static PaperSource class.
InputPdf pdf = new InputPdf(@"C:\MyDocument.pdf");
Printer printer = new Printer("PrinterName");
PrintJob printjob = new PrintJob(printer,pdf);
//Setting paper source using PaperSource class.
PaperSource paperSource= printer.PaperSources.Automatic;
printjob.PrintOptions.PaperSource = paperSource;
printjob.Print();
Method2:Setting Paper source using the paper source name.
InputPdf pdf = new InputPdf(@"C:\My Document.pdf");
Printer printer = new Printer("PrinterName ");
PrintJob printjob = new PrintJob(printer,pdf);
PaperSourceList list = printer.PaperSources;
for (int i = 0; i < list.Count; i++)
{
Console.WriteLine("PaperSource " + list[i].Name);
}
//Setting paper source using the name of the tray.
printjob.PrintOptions.SetPaperSourceByName("Drawer 2");
printjob.Print();
Console.Read();
Thanks,
ceTe Software Support Team.