Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Dear friends,

In my win form application i want to preview and print number of images at a time.
So i used a imageList for multiple images and a printDocument and a printPreviewDialog for preview and printing.

My code is as follows :

C#
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
       {

           Image i = imageList1.Images[1];

           e.Graphics.DrawImage(i, 100, 50,i.Width, i.Height);


       }


but when it never takes the original image height and width. It reduces the height and width of my image.

How can i solve this problem. I want to retain the original height and width of my image.

Thanks in Advance.
Shailesh.
:-)
Posted

See this one: http://www.morgadinho.org/2007/02/27/c-printing-an-image-file/[^]
What is the "original" size of an image? Both have resolution. You probably get the image in it's original size in pixels. I suppose, your image's resolution does not match that of the printer. And by the way a printer's X and Y resolution is not the same in every case. Thus you have tho think in inches not in pixels, and recalculate the size.
 
Share this answer
 
v2
You provided very short code samples. However, I assume that you need to preview some images and then print them. See this one, there are a lot of convinient image processing commands including preview, print image, print batch and so on: http://www.artuxsoft.com/.
 
Share this answer
 
v7

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900