Confused about printing, pagebounds, and printer resolution

C

Chris Dunaway

When using PrintDocument to print something, if I check the PageBounds
property of the PrintPageEventArgs object, it shows the rectangle to be
850 x 1100, or 100 dpi. But when I check the value of the
PrintDocument.PrinterSettings.DefaultPageSettings.PrinterResolution.X
property for the printer in question it shows 600 dpi?

If I perform the following:

e.Graphics.FillRectangle(Brushes.Gainsboro, 40, 40, 500, 100);

in the PrintPage event, I get a gray rectangle that is exactly 5 inches
by 1 inch, or 100 dpi.

What is the relationship of the rectangle returned by the PageBounds
property to the dpi of the printer?

I tried changing the resolution of the printer but it still seemed to
print at 100 dpi.

Can anyone clear this up for me?

Thanks
 
G

Guest

Set the pageunit property in the PrintPage event - I have my data stored in
inches, so I set it like this:

e.Graphics.PageUnit = GraphicsUnit.Inch; // or whatever unit you want.

If you do this, you don't have to worry about the DPI of the printer.
 

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