0

I would like to print a document out from my c# file but I don't know the total orientation for the size of paper. For example:

e.Graphics.DrawImage(newImage, 25, 25, newImage.Width, newImage.Height);

What does the "25" mean? And what is the total size?

Jashaszun
  • 9,207
  • 3
  • 29
  • 57
JoJo
  • 1
  • 1
  • 2
    a) Didn't you try google first?? b) The total size will depend on the dpi of image and Graphics object.. - There is also a DrawImage overload, that will let you increase/decrease the image size. – TaW Aug 03 '15 at 20:27

1 Answers1

0

From the documentation on DrawImage(Image, Int32, Int32, Int32, Int32), the first two integers are the x- and y-coordinates (in pixels), and the last two integers are how big you want to draw your image.

This has nothing to do with the size of the paper (but you can map pixels to inches via DPI calculations).

Since you're just using your image's width and height and passing them through the function, you might want this overload instead (DrawImage(Image, Int32, Int32)). Just pass newImage, 25, 25.

Jashaszun
  • 9,207
  • 3
  • 29
  • 57
  • 1
    This should be relevant as well: https://msdn.microsoft.com/en-us/library/fwb00wkk(v=vs.110).aspx – Chris Aug 03 '15 at 20:47