Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

C# WinForms: Breaking up a PrintDocument into pages?

I have the code for the attached file printing fine (the word 'test'), but I need to find out how to parse my text file document into individual pages.

How does that work?

As you can see in the demo which I have working, this line:

e.Graphics.DrawString("test",new Font(FontFamily.GenericSerif,12),
                  Brushes.Black,100,100);

prints one word.  I have a multi-page text file.  Must I iterate through the lines and pass each line into DrawString()?  Is there an easier way?

Also, if I am to iterate, then I presume I must also determine if I am near a page break.  And this is starting to sound like a Printer Device Context object, which I hope I do not need to deal with.

Please let me know.

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of curiouswebster

ASKER

Thanks.  I had already discovered:

 e.HasMorePages = true

is key.

Thanks.