爲了將PDF打印到特定打印機,您需要使用DynamicPDF PrintManager for .NET產品。您可以在運行時爲每個頁面指定紙張來源,如下所示。
InputPdf pdf = new InputPdf(@"Path for Input PDF");
Printer printerObj = new Printer("Printer name");
PrintJob printJobObj = new PrintJob(printerObj, pdf);
//Setting paper source for whole print job.
printJobObj.PrintOptions.PaperSource = printerObj.PaperSources[1];
//Setting specific tray as paper source for first page in the print job.
PrintJobPage page1 = printJobObj.Pages[0];
page1.PrintOptions.Inherit = false;
page1.PrintOptions.PaperSource = printerObj.PaperSources[2];
//Setting specific tray as paper source for second page in the print job.
PrintJobPage page2 = printJobObj.Pages[1];
page2.PrintOptions.Inherit = false;
page2.PrintOptions.PaperSource = printerObj.PaperSources[3];
printJobObj.Print();
聲明:我爲開發DynamicPDF庫的公司ceTe Software工作。