title: How to resize an iTextSharp.text.Image size into my code?
body: <p>I am pretty new in <strong>iText</strong> nd <strong>iTextSharp</strong> (the C# version of iText) and I have the following problem.</p>
  
  <p>I am inserting some jpg charts inside my PDF. These charts are rapresented by some jpg like this one:</p>
  
  <p><img src="https://i.stack.imgur.com/qeOA5.jpg" alt="enter image description here"></p>
  
  <p>I insert it into a table of my PDF in this way:</p>
  
  <pre><code>iTextSharp.text.Image img = null;
  
  ..........................................
  ..........................................
  ..........................................
   if (currentVuln.UrgencyRating &gt; 0)
                  {
                      img = ChartHelper.GetPdfChartV2((int)currentVuln.UrgencyRating * 10, _folderImages);
                      vulnerabilityDetailsTable.AddCell(new PdfPCell(img) { Border = PdfPCell.RIGHT_BORDER, BorderColor = new BaseColor(79, 129, 189), BorderWidth = 1, Padding = 5, MinimumHeight = 30, PaddingTop = 10 });
                  }
  </code></pre>
  
  <p>And this is a section of the <strong>GetPdfChartV2()</strong> method in which I load a chart immage:</p>
  
  <pre><code>    public static iTextSharp.text.Image GetPdfChartV2(int percentage, string _folderImmages)
      {
          iTextSharp.text.Image chart = null;
          string folderImmages = _folderImmages;
  
          if (percentage == 0)
          {
              return null;
          }
          else if (percentage == 10)
          {
              chart = iTextSharp.text.Image.GetInstance(_folderImmages + "1.jpg");
          }
  
          else if (percentage == 20)
          {
              chart = iTextSharp.text.Image.GetInstance(_folderImmages + "2.jpg");
          }
          ....................................................
          ....................................................
          ....................................................
          else if (percentage == 100)
          {
              chart = iTextSharp.text.Image.GetInstance(_folderImmages + "10.jpg");
          }
  
          return chart;
      }
  
  }
  </code></pre>
  
  <p>The problem is that the chart immage is too big for my PDF and I obtain this orrible result:</p>
  
  <p><img src="https://i.stack.imgur.com/AFLWg.png" alt="enter image description here"></p>
  
  <p>So I have the following 2 questions:</p>
  
  <p>1) Can I resize the <strong>iTextSharp.text.Image</strong> size into my code or have I to do it with an image editor?
  If is it possible where have I to do it? when I load the immage into <strong>GetPdfChartV2()</strong> by the lines as:</p>
  
  <pre><code>chart = iTextSharp.text.Image.GetInstance(_folderImmages + "1.jpg");
  </code></pre>
  
  <p>or when I put the immage into my PDF table cell:</p>
  
  <pre><code>vulnerabilityDetailsTable.AddCell(new PdfPCell(img) { Border = PdfPCell.RIGHT_BORDER, BorderColor = new BaseColor(79, 129, 189), BorderWidth = 1, Padding = 5, MinimumHeight = 30, PaddingTop = 10 });
  </code></pre>
  
  <p>Can you help me to solve this issue?</p>
  
  <p>2) Why when I see the previous chart immage on my Windows Photo Viewer (100% of the size) I see it much smaller or here in the StackOverflow page?</p>