We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Printing PDF pages from different printer trays

Is it possible to print pages from a PDF document from different printer trays? Let say I want to print first and last page from tray 2 and all the inbetween pages on tray 1. Is that possible with Aspose.PDF?

Hi Michael,

Thanks for your inquiry. As your query is more related to Aspose.Pdf, I am moving your request in Aspose.Pdf forum. My colleagues will answer you shortly.

Best regards,

Hi Michael,

Thanks for your inquiry. You may accomplish your requirement with your own logic while using page range and print source tray properties. Please check Aspose.Pdf printing options and sample code snippet to use subjected properties.

//create objects for printer and page settings and PrintDocument

System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();

System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();

//specify your printer name

ps.PrinterName = myPrinterName;

ps.PrintRange = PrintRange.SomePages;

ps.FromPage = 1;

ps.ToPage = 2;

//set PageSize (if required)

pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);

//set PageMargins (if required)

pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);

//Here you can set the PaperSource which you want to use as per your printer.

pgs.PaperSource = ps.PaperSources[1];

//print document using printer and page settings

viewer.PrintDocumentWithSettings(pgs, ps);

Please feel free to contact us for any further assistance.

Best Regards,

Hi Tilal.

Unfortunately your reply does not answer my question.

I want to be able to send a document to the printer and have the printer print some pages from one tray and some pages from another tray.

Please carefully read my inquiry again.

Hi Michael,

We are sorry for any confusion. You have requirement to use different print tray as paper source for different range of pages and as suggested above you may accomplish your requirement with some custom logic using PrinteRange, FromPage, ToPage and PaperSource(paper source tray) properties of PrintSetting class. e.g. can break one printing job into more for different page ranges according to printing trays. If still there is any difference in your requirements and my understanding then I will appreciate it if you please share some more details about your requirements.

Please feel free to contact us for any further assistance.

Best Regards,

Hi Tilal. I understand that I can break it up into several prints, but that is not an option. We have to be able to send a document to printer and be sure that there are no other printjobs in between our pages. The document must be printet as one.

In .NET we are able to do this by using the printDocument_QueryPageSettings event on the PrintDocument object. But we cannot figur out how to do it with Aspose.Pdf.Facades.PdfViewer.

Hi Michael,

Thanks for your feedback. We have logged an enhancement ticket PDFNEWNET-37406 in our issue tracking system for your requirements. We will keep you updated about the issue resolution progress.

We are sorry for the inconvenience caused.

Best Regards,

Hi Tilal. Does this mean that you do not currently support the mentioned scenario and will implement this in future releases?

Hi Michael,

Thanks for your feedback. Yes currently the feature is not available in Aspose.Pdf for .NET and our development team will investigate the issue and will implement it accordingly. I am afraid we can not confirm the ETA before the investigation completes.

We are sorry for the inconvenience caused.

Best Regards,

Thank you. We hope soon to receive any status because our choice of supplier heavily depends on this feature.

Hi Michael,

As shared by Tilal, as soon as this problem gets resolved, we will update you within this forum thread. Your patience and comprehension is greatly appreciated in this regard.

Hi Michael,

Thanks for your patience.

The development team has further investigated the earlier reported issue and as per our current estimates, we plan to get this problem fixed in Aspose.Pdf for .NET 9.8.0 (which is planned to release in November-2014). However its not a promise but we will try our level best to get this problem fixed by said time. Please be patient and wait for the resolution.

Hi Michael,

Thanks for your patience.

In order to print different page range to different paper source trays, you should use

PdfViewer.PdfQueryPageSettings event handler

Following code snippet shows how to print even and odd page numbers to different sources:


pdfv = new Aspose.Pdf.Facades.PdfViewer();<o:p></o:p>

pdfv.PdfQueryPageSettings +=

pgs = new System.Drawing.Printing.PageSettings();<o:p></o:p>

prin = new System.Drawing.Printing.PrinterSettings();<o:p></o:p>


prin.PrinterName = “HP
LaserJet M9050 MFP PCL6”

prin.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize(“A4”, 827, 1169);<o:p></o:p>

pageEditor = new Aspose.Pdf.Facades.PdfPageEditor();<o:p></o:p>


pgs.Margins = new
System.Drawing.Printing.Margins(0, 0, 0, 0);<o:p></o:p>

pgs.PaperSize = prin.DefaultPageSettings.PaperSize;<o:p></o:p>

pdfv.PrintDocumentWithSettings(pgs, prin);<o:p></o:p>


private void
PdfvOnPdfQueryPageSettings(object sender, QueryPageSettingsEventArgs
queryPageSettingsEventArgs, PdfPrintPageInfo currentPageInfo)<o:p></o:p>


bool isOdd = currentPageInfo.PageNumber % 2 != 0;<o:p></o:p>

paperSources =

if (isOdd)<o:p></o:p>

queryPageSettingsEventArgs.PageSettings.PaperSource = paperSources[0];<o:p></o:p>


queryPageSettingsEventArgs.PageSettings.PaperSource = paperSources[1];<o:p></o:p>


The issues you have found earlier (filed as PDFNEWNET-37406) have been fixed in Aspose.Pdf for .NET 9.8.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.