Choose Paper Source for each page in PDF

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF PrintManager for .NET (v2)  /  Choose Paper Source for each page in PDF

DynamicPDF PrintManager for .NET (v2) Forum

I do not have PrintManager but currently installing it now to see if it does what I need it to do. I do have PDF Generator and Merger but correct me if I am wrong, I do not think it will do this.

I need to be able to print a 2 page pdf. The first page of that PDF will need to be printed on an envelope/standard letter and then the second page will just be a normal sheet of paper. Is there anyway to have this to where I can just have a print button on my ASP.NET web page and it will automatically know to print that first page without having to print two individual documents and choosing the paper source for each. Very time consuming doing this way. If you have some code that can do that I would appreciate it!!

Thanks!
Posted by a ceTe Software moderator
Hello,

The DynamicPDF Generator/Merger products allow you to generate PDFs from scratch and merge the existing PDFs.

In order to print the PDFs to a specific printer,  you will need to use the DynamicPDF PrintManager for .NET product. You can achieve your requirement by specifying the paper source for the PDF pages dynamically. Please refer to the documentation on PaperSource class of PrintManager API here. Also below is the code sample for setting different paper sources(tray/drawer) to different pages.

Also you will need to know what paper size is placed in the each trays of Printer and set the paper source to the PrintJobPage accordingly.

            //code sample for setting the PaperSornce .
            InputPdf pdf = new InputPdf(@"Path for Input PDF");
            Printer printerObj = new Printer("Printer name");
            PrintJob printJobObj = new PrintJob(printerObj, pdf);
            //Code sample for setting paper source for whole print job.
            printJobObj.PrintOptions.PaperSource = printerObj.PaperSources[1];

            //Code sample for setting specific tray as papersource for first page in the printjob.
            PrintJobPage page1 = printJobObj.Pages[0];
            page1.PrintOptions.Inherit = false;
            page1.PrintOptions.PaperSource = printerObj.PaperSources[2];

           //Code sample for setting specific tray as papersource for second page in the printjob.
            PrintJobPage page2 = printJobObj.Pages[1];
            page2.PrintOptions.Inherit = false;
            page2.PrintOptions.PaperSource = printerObj.PaperSources[3];

            printJobObj.Print();

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 2:37 AM.