title: ITextSharp PDF image is coming out with different DPI
body: <p>I have this section of code my image is configured to 203 DPI which is the default for most printers. However it seems as though ITextSharp defaults to an image DPI of 72. I need it to default to a DPI of 203, is there any comprehensive way of doing this without having to resize or recreate the image? </p>
  
  <p>The purpose of this is that the PDF generated comes out to a 4 x 5 Inch PDF document currently the PDF being generated by this code is coming out to </p>
  
  <blockquote>
    <p>11.3 inches X 14.1 inches (DPI 72)</p>
  </blockquote>
  
  <p>instead of </p>
  
  <blockquote>
    <p>4 inches x 5 inches (DPI 203)</p>
  </blockquote>
  
  <p>I have seen this article however for my purposes it does not help</p>
  
  <p><a href="https://stackoverflow.com/questions/2752789/how-to-calculate-the-correct-image-size-in-out-pdf-using-itextsharp/2764175#2764175">How to calculate the correct image size in out pdf using itextsharp?</a></p>
  
  <p><strong>I need for the PDF document to use the SAME DPI I use for everything else in my code which is 203</strong></p>
  
  <p>My code below:</p>
  
  <pre><code>private byte[] getPDFDocument(MemoryStream inputImageStream)
  {
      using (MemoryStream workStream = new MemoryStream())
      {
          iTextSharp.text.Document document = new iTextSharp.text.Document(new iTextSharp.text.Rectangle(0, 0, 812, 1015));
          PdfWriter.GetInstance(document, workStream).CloseStream = false;
  
          document.Open();
          iTextSharp.text.Image pdfImage = iTextSharp.text.Image.GetInstance(inputImageStream.ToArray());
          pdfImage.SetAbsolutePosition(0, 0);
          document.Add(pdfImage);
          document.Close();
  
          byte[] byteInfo = workStream.ToArray();
          workStream.Write(byteInfo, 0, byteInfo.Length);
          workStream.Position = 0;
  
          return workStream.ToArray();
      }
  }
  </code></pre>