I have an ASP.NET Application using Web Forms that I am trying to print a PDF. I currently use DynamicPDF to generate that PDF in a new tab but the Dynamic PDF module that our company has does not deal with printing.
I need to print a two page PDF. The 1st page needs to be for an envelope and then the 2nd page will need to print a regular piece of paper like normal. Anybody have any idea how to set that paper source in code? Ideally I just want to hit print on my web page and the printer knows to print the first page envelope and the 2nd page regular. Having my users change that setting every time they print something is a HUGE draw back. Any ideas or any tools that can accomplish this?
Thanks!!
In order to print a PDF to a specific printer, you will need to use the DynamicPDF PrintManager for .NET product. You can specify the paper source for each page during runtime as shown below.
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();
Disclaimer: I work for ceTe Software, the company that develops DynamicPDF libraries.