In a .net console application, how can I print selected pages that do not adjoin one another? The PrinterSettings object only seems to provide the Selected enumeration with no place to programatically set the selection. The Application object in the MS Word Interopt takes a string argument for this in its PrintOut method but I see nothing comparable here. Any ideas?
Thanks for your request. I think in this case you can try using the following code:
Document doc = new Document("in.doc"); PrinterSettings settings = new PrinterSettings(); settings.PrinterName = "hp LaserJet 1010 Series Driver"; settings.PrintRange = PrintRange.SomePages; settings.FromPage = 1; settings.ToPage = 1; doc.Print(settings); settings.FromPage = 4; settings.ToPage = 4; doc.Print(settings);
Also please see the following link for more information: