Well' I'm trying to print image from my PictureBox...this is my code for drawing image:

e.Graphics.DrawImage(PictureBox1.Image, 0, 0)

But I need something more specified...when I print my document with this code, for some of those, I don't get the whole document. So I need to specify that...I need to stretch my image to my A4 page so that m. How can I do that? Hope someone could help me.

Well' I'm trying to print image from my PictureBox...this is my code for drawing image:

e.Graphics.DrawImage(PictureBox1.Image, 0, 0)

But I need something more specified...when I print my document with this code, for some of those, I don't get the whole document. So I need to specify that...I need to stretch my image to my A4 page so that m. How can I do that? Hope someone could help me.

I have attached a printing application sample with this reply, download it and run it , its a vs 2008 sol , hope you have expression edition or pro.

After you run the sample, make sure you become familiar with PrintDocument. because it is the central part of printing process..

Now here is the solution:

You said I need to stretch my image to my A4 page

Use the "Page Setup Dialog" to set your page type to A4

'where printdocument1 is a PrintDocument Control
PrintDocument1.DefaultPageSettings.PaperSize

'the above property exposes the current height and width of a 
'page in pixels

with PrintDocument1.DefaultPageSettings.PaperSize

dim ImageSize as size = new size(.width,.height)

'You now have you stretch your image to this size

'And in the Print Event Of PrintDocument you can draw this image 


end with

I hope this helps, if it doesnt you are welcome to reply and ask for more help.

I have attached a printing application sample with this reply, download it and run it , its a vs 2008 sol , hope you have expression edition or pro.

After you run the sample, make sure you become familiar with PrintDocument. because it is the central part of printing process..

Now here is the solution:

You said I need to stretch my image to my A4 page

Use the "Page Setup Dialog" to set your page type to A4

'where printdocument1 is a PrintDocument Control
PrintDocument1.DefaultPageSettings.PaperSize

'the above property exposes the current height and width of a 
'page in pixels

with PrintDocument1.DefaultPageSettings.PaperSize

dim ImageSize as size = new size(.width,.height)

'You now have you stretch your image to this size

'And in the Print Event Of PrintDocument you can draw this image 


end with

I hope this helps, if it doesnt you are welcome to reply and ask for more help.

thanks a lot, i've solved my problem.

I actually need to print the same way as this. Please provide complete code for this one. Im a new and not so good vb.net programmer.
tnks.

I actually need to print the same way as this. Please provide complete code for this one. Im a new and not so good vb.net programmer.
tnks.

just give a carefull reading to this forum and you will find that ive attached a sample application for printing in my first reply......

This article has been dead for over six months. Start a new discussion instead.