Change Print Setting

  • Thread starter Thread starter Rainbow
  • Start date Start date
R

Rainbow

Hi,

I tried to change the print setting by

PrintDialog dlg = new PrintDialog();
dlg.AllowSomePages = true;
dlg.AllowSelection = true;
dlg.Document = pd;
dlg.PrinterSettings.MinimumPage = 1;
dlg.PrinterSettings.MaximumPage = 1;
pd.PrinterSettings.FromPage = 1;
pd.PrinterSettings.ToPage = 1;
pd.DocumentName = "test";
pd.Print();

while pd is a document with 3 pages.

The result is always 3 pages printed.
I think I did not change the print setting actually.
What's wrong?

More if I want to print to file, how I can specify the
file name to print?

Thanks a lot.
 
From what I remember all your doing is setting some variables. Your printing
code tells the printing system to stop printing by setting
PrintPageEventArgs.HasMorePages to false via your PrintDocument.PrintPage
supplied delegate. So you need to check what page your on and set
HasMorePages accordingly given the "from" and "to" settings.

Regards
Lee
 
Back
Top