Member Avatar for Peric

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.

Member Avatar for Peric

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.

thanks a lot, i've solved my problem.

Thats good , always happy to help :)

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......

hi how can i print the image that in picturebox. can u help me..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.