Rohit Arora

Rohit Arora

  • NA
  • 2
  • 0

how to calculate Image size in pixel to Print on A4 size sheet

Jul 6 2010 1:16 AM
hi
I am generating an image with GDI+ and pasting it in Excel work sheet. I am setting Excel sheet print size as A4 (8.27" X 11.69").
I want to generate image so that it should fit in A4 perfectly, but I am unable to calculate image size in pixels to fit perfectly in 8.27" X 11.69" inches.  My system default setting is 96 dpi.

I applied some logic:-
            Dim g As Graphics = this.CreateGraphics()
            image.Width = CInt(8.27 * g.DpiX)
            image.Height = CInt(11.69 * g.DpiY)


but image is not still printing within A4. Is there anything that I am missing ?


Thanks


Answers (2)