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

Free Support Forum - aspose.com

How to print specific pages of word

Hello Aspose experts,
I have a quick question, which is how to code to print specific pages.
I do realize we can use PrintRange.SomePages and (FromPage, ToPage) to pring a range.
But how can I print pages like (3, 5-9)?


Please use the following code example to print a range of pages.

Document doc = new Document(MyDir + "Rendering.doc");

PrinterSettings printerSettings = new PrinterSettings();
// Page numbers in the .NET printing framework are 1-based.
printerSettings.FromPage = 1;
printerSettings.ToPage = 3;


Thanks for your reply.
But how do I print pages like (3, 5-9) , which means I want to print page (3,5,6,7,8,9)?


Aspose.Words does not provide API to print custom pages like (3, 5-9).

Please note that Aspose.Words uses .NET printing API to print the document. Please try Document.Print method (PrinterSettings) to print the document according to the specified printer settings.