Incorrect tray is used


I’m not able to print a given pdf document by using a specific paper source.
I have tried several things:

  • PrintDocumentWithSettings(printerSettings);
  • PrintDocumentWithSettings(pageSettings, printerSettings);
  • Attached to PdfQueryPageSettings event and set papersource
    Nothing helped, the tray is never used. When I print the file using Acrobat, everything works fine.
    We are using a Kyocera TASKalfa 2552ci KX printer.

This is the test code:

        var file = @"C:\Temp\testfile.pdf";
        document = new Aspose.Pdf.Document(file);

        var viewer = new PdfViewer(document);

        var printers = System.Drawing.Printing.PrinterSettings.InstalledPrinters;
        var ps = viewer.GetDefaultPrinterSettings();
        ps.PrinterName = printers[6];
        ps.FromPage = 1;
        ps.ToPage = 1;
        ps.PrintRange = System.Drawing.Printing.PrintRange.SomePages;

        var pageSetting = new System.Drawing.Printing.PageSettings();
        for (int index = 0; index < ps.PaperSources.Count; index++)
            if (ps.PaperSources[index].SourceName == "Kassette 2")
                pageSetting.PaperSource = ps.PaperSources[index];
                ps.DefaultPageSettings.PaperSource = pageSetting.PaperSource;

        viewer.PrintDocumentWithSettings(pageSetting, ps);

From my point of view the code is correct. Could the reason be a printer driver problem?

Thanks in advance.


Thanks for contacting support.

Yes, your code seems fine and should work as expected. But it seems like the issue is not related to Aspose.PDF but with .NET Class i.e. System.Drawing.Printing.PrinterSettings. It is quite possible that PrinterSettings is unable to load all available trays/PaperSource of the printer.

Could you please try double checking if ps.PaperSources contains the required PaperSource. In case it has required tray and still code is not working, please let us know. We will further proceed to assist you accordingly.


Thanks for the quick response!
I’m absolutely sure that the correct paper source is used.
image.png (9.6 KB)
Is there anything else which I can check? Some kind of Log file etc?



Thanks for getting back to us.

You may please check this similar post over our forums and make sure to try these steps as well. In case things still do not work correctly at your end, please let us know. We will further proceed accordingly.


thanks, I have already seen this post, but the final message is about aspose word (UpdatePageLayout call).
There was no solution provided for aspose pdf and I could not find any reference on the created ticket (PDFNET-45820).



Thanks for your feedback.

The ticket is still pending for analysis due to other pending issues in the queue. As your issue seems similar, we have associated the ticket with you post as well. As soon as there are some updates regarding ticket resolution, we will inform you. Please spare us little time.

We are sorry for the inconvenience.