Printing Images Help Please

coolpjmartin

Member
Joined
Aug 8, 2006
Messages
9
Programming Experience
Beginner
Hi
I am developing a vb.net application that displays pictures (JPG and PDF etc) inside a picturebox,
I have set the picturebox size mode to Zoom so as the image displays correctly in the picturebox.
These images are held on the hard drive.
I have added a print dialog, print preview dialog, print document to the form and I am trying to print the image
displayed in the picturebox to the printer, the problem I have is in the print preview it only display part of the image and does not display the image as in the picturebox

If I chnage the size mode on the picturebox to normal the image display in the picturebox is no longer displayed in the picture correctly, what you see in the picturebox is now the same as the image in the print preview.

Is there anyway I can scale the print preview to fit as in the picturebox (in zoom mode), Some images I want to print need to be scaled to fit a full page A4

can anbody help with some same code please

Thanks
 
You print the image in PrintDocument.PrintPage event handler through e.Graphics using one of the 30 Graphics.DrawImage methods where you specify the rectangle or x/y/width/height of image scaled. Calculate the scale you want limited to the e.MarginBounds of the paper. MarginBounds is the printing area within margins settings, and this vary according to what paper size and orientation (landscape/portrait) user chooses to print on.

Post was moved to Reporting/Printing forum.
 
Back
Top