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

Free Support Forum - aspose.com

PrintDocumentWithSettings is only printing the first page


We’re having an issue with printing from Aspose.Pdf.Kit using the PrintDocumentWithSettings function where only the first page is being printed. Please see the attached Pdf and Xps files. The XPS shows the issue occurring.

This functionality works just fine when we call PrintDocument() and is using the default printer. But when we specify the PrinterSettings object using PrintDocumentWithSettings, retrieved from the Windows Print dialog, we see the issue.

I saw a similar post (Is it possible to print PDF directly from code without the use of the viewer?) but the issue still occurs for us. Seems that customer had better results using PrintLargePdf. However, we cannot use that function as it doesn’t account for double-sided printing and printing multiple pages on a single sheet of paper. So, it looks like this issue may already be logged as PDFKITNET-11165.

Our code is:

viewer = new PdfViewer();
viewer.AutoResize = true;
viewer.AutoRotate = true;
viewer.PrintPageDialog = false;


if (printerSettings != null)

printerSettings is set if the request is coming from the File -> Print command of our application and the user selects the settings and printer they wish to use. printerSettings is null if we our printing the file in the ‘unattended’ mode of our application where we just want to print the file using the default settings.

This functionality did not work with Pdf.Kit either. A previous version of our product used Pdf.Kit and that was the last we have noticed it working. We have not tried any other intervening versions.

We are coming up on a release soon and would like to request a fix within the next two weeks, if at all possible, so that our test team has adequate time to test this feature. If you need any other information please let me know.


Hi John,

In order to print all the pages using PrintDocumentWithSettings, you need to specify FromPage and ToPage values as shown below:

printerSettings.FromPage = 1

printerSettings.ToPage = 4

Please try it at your end and see if it works for you. I have tested the file at my end and it is working fine.

If you find any other questions or issues, please do let us know.

That works for me, thanks!

However, it did not work this way in the past… The print dialog sets these values to 0 if the ‘print all pages’ option is selected. Why was this functionality changed?


Hi John,

Thank you for pointing this out. I have logged the ‘Print all Pages’ issue as PDFKITNET-11249 in our issue tracking system. Our team will be looking into the matter and you’ll be updated via this forum as the issue is resolved.

If you have any further questions, please do let us know.

The issues you have found earlier (filed as 11249) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.