0

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!!

4

1 に答える 1

1

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 で働いています。

于 2016-07-27T13:20:59.793 に答える