Click here to Skip to main content
15,914,452 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
i want to print an image in a4 or a3 sheet.how can i do this
Posted

1 solution

Hi, you can print an image using the PrintDocument[^] class.

Just use the Graphics.DrawImage() method in the PrintDocument's PrintPage event:

C#
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) 
{
   e.Graphics.DrawImage(m_image, 0, 0);
}


The above code assumes that your image is loaded in
C#
Bitmap m_image;
member.

For setting the paper size you can use PrintDocument's DefaultPageSettings.PaperSize property.

I hope this helps! :)
Regards
 
Share this answer
 

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