Change Print Setting

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.
 
L

Lee Alexander

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top