title: How to print a full size image in c#
body: <p>I am trying to print an image in C#.  It is a full 8.5x11 size tiff created by Adobe Acrobat from a PDF.  When I print it with C# using the code below, it prints correct vertically, but not horizontally, where it is pushed over about a half inch.  I set the origin of the image to 0,0.  Am I missing something?</p>
  
  <pre><code>private FileInfo _sourceFile;
      public void Print(FileInfo doc, string printer, int tray)
      {
          _sourceFile = doc;
          PrintDocument pd = new PrintDocument();
          pd.PrinterSettings.PrinterName = printer;
          pd.DocumentName = _sourceFile.FullName;
          using (Image img = Image.FromFile(_sourceFile.FullName)) {
              if (img.Width &gt; img.Height) {
                  pd.DefaultPageSettings.Landscape = true;
              }
          }
          pd.PrintPage += PrintPage;
          foreach (PaperSource ps in pd.PrinterSettings.PaperSources) {
              if (ps.RawKind == tray) {
                  pd.DefaultPageSettings.PaperSource = ps;
              }
          }
          pd.Print();
      }
  
      private void PrintPage(object o, PrintPageEventArgs e)
      {
          using (System.Drawing.Image img = System.Drawing.Image.FromFile(_sourceFile.FullName)) {
              Point loc = new Point(0, 0);
              e.Graphics.DrawImage(img, loc);
          }
      }
  </code></pre>