470,826 Members | 1,811 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,826 developers. It's quick & easy.

Confused about printing, pagebounds, and printer resolution

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

Apr 13 '06 #1
1 3793
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.
"Chris Dunaway" wrote:
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

Apr 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by JF Turcotte | last post: by
1 post views Thread by Mina Gohari | last post: by
1 post views Thread by Dreamtime | last post: by
6 posts views Thread by Lloyd Dupont | last post: by
1 post views Thread by jake | last post: by
8 posts views Thread by Frank Rizzo | last post: by
1 post views Thread by mehdi | last post: by
1 post views Thread by Glenn | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.