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
Loading
Nicole AndersonPosted Aug 5, 2010, 7:04 AM
This is Nicole.
The formula you have given is very useful to calculate the size of the image.
i.e width and height.
Thank you.
__________________________________________________________________
Discover the hidden source of targeted traffic that unearths eager buying customers, drives them straight to your site, and literally explodes your profits almost overnight at just simple click [url=http://uniquearticlepro.com/] unique article wizard.[/url]
Hirendra SisodiyaPosted Jul 7, 2010, 2:21 AM
i think you need to resize image
but you can do this as above
you can try this code:
Dim g As Graphics = Me.CreateGraphics()
g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
g.DrawImage(Image, New Rectangle(0, 0, CInt(8.27 * g.DpiX), CInt(11.69 * g.DpiY)), New Rectangle(0, 0, Image.Width, Image.Height), GraphicsUnit.Pixel)
and use highlighted image
thanks
Plese mark as answer if it helps