Using PrintDialog

joe_pool_is

Contributor
Joined
Jan 18, 2004
Messages
507
Location
Longview, TX [USA]
I need a way to add the total number of pages in a document to the PrintDialog:

Code:
PrintDocument printDoc = new PrintDocument();
void GenericFn()
{
  PrintDialog pd = new PrintDialog();
  pd.Document = printDoc;
  pd.PrinterSettings.FromPage = 1;
  pd.PrinterSettings.ToPage = 1; // how do I set this value from printDoc?
  pd.ShowDialog();
}

I'm using this DataGridViewer Printer class that nicely handles sending all of the code from the DataGridViewer to the printer using PrintDocument.PrintPage and PrintDocument.BeginPrint routines, but the code doesn't have a way to determine how many pages are in the entire document.

Is anyone here skilled in this?

I'd like my operators to be able to select only 1-5 pages to print, or cancel when they see it contains 115 pages, etc.
 
Back
Top