Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I hav Tried this , But when i print the image in A4 size paper it cut half image .
please give me solution that image should feet in A4 size paper:

What I have tried:

I hav Tried this , But when i print the image in A4 size paper it cut half image .
please give me solution that image should feet in A4 size paper:

C#
private void button1_Click(object sender, EventArgs e)
{
PrintDialog pd = new PrintDialog();
PrintDocument doc = new PrintDocument();
doc.PrintPage += Doc_PrintPage;
pd.Document = doc;
if (pd.ShowDialog() == DialogResult.OK)
doc.Print();

}

private void Doc_PrintPage(object sender, PrintPageEventArgs e)
{

Bitmap bm = new Bitmap(pictureBox1.Width,pictureBox1.Height);
pictureBox1.DrawToBitmap(bm, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height));
e.Graphics.DrawImage(bm,0,0);
bm.Dispose();
}
Posted
Updated 29-Apr-18 0:14am
v3
Comments
Richard MacCutchan 29-Apr-18 4:45am    
You need to scale the image to the dimensions of the paper.

1 solution

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