Mefhisto1
Mefhisto1

Reputation: 2228

Use PrintDialog to print specific pages (without using from-to)

I would like to print specific pages using Windows Forms PrintDialog. For example, pages I'd like to print are something like: 1-3, 5, 7-9, 15, 21.

Can this be achieved using regular PrintDialog? I only found that it's possible to set from and to pages.

Upvotes: 1

Views: 842

Answers (1)

cdev
cdev

Reputation: 5361

I don't think you can achieve that using regular PrintDialog. It allows only one range.

The PrintRange property is used by the PrintDialog.when the user selects a print range. The default PrintRange is AllPages. To enable the user to specify a range of pages to print, the PrintDialog.AllowSomePages property must be set to true. To enable the user to specify the selected pages to print, the PrintDialog.AllowSelection property must be set to true.

https://learn.microsoft.com/en-us/dotnet/api/system.drawing.printing.printersettings.printrange?view=netframework-4.8

https://learn.microsoft.com/en-us/dotnet/api/system.drawing.printing.printersettings.frompage?view=netframework-4.8#System_Drawing_Printing_PrinterSettings_FromPage

Upvotes: 3

Related Questions