We help IT Professionals succeed at work.
Get Started

Print an image to a specific size paper (11x17)

Last Modified: 2013-12-03
Hey all -
I have an image that I'm trying to print on 11x17 paper. I've used the code below. Whenever i do a print preview, it comes up alined to the right and the right part is cropped by about 2 inches. I've tried several different resolutions and have attempted to set margins, thinking that's the problem. My code is below and I'm really up for other ideas, especially ones that allow for more flexability as the client may want to eventually print at 8.5/11. However, i'm really interested in 11x17 and to get all of teh image on the page. The image is portrait and I'd rather it didn't crop. I can resize the image. however,it somehow appears to do the same thing everytime I tweak the image size.
protected void btnPrint_Click(object sender, EventArgs e)
            PrintDocument pd = new PrintDocument();
            //set printer to use 11x17            
             foreach (PaperSize paperSz in pd.PrinterSettings.PaperSizes )
             if (paperSz.PaperName.StartsWith("11x17"))
             pd.DefaultPageSettings.PaperSize = paperSz;
            pd.PrintPage += new PrintPageEventHandler(pqr);
            PrintPreviewDialog dlgPrintPreview = new PrintPreviewDialog();
            // Set any optional properties of dlgPrintPreview here...
            dlgPrintPreview.Document = pd;
        void pqr(object o, PrintPageEventArgs e)
            System.Drawing.Image i = System.Drawing.Image.FromFile("C:\\TEMP\\test.jpg");
            Point p = new Point(100, 100);
            e.Graphics.DrawImage(i, p);

Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE