title: How to Add image in pdf using C# and iTextSharp?
body: <p>I need your help adding an image to a PDF.</p>
  
  <p>I'm using:</p>
  
  <pre><code>string imgPath2 = localPath + "\\TempChartImages\\" + LegendPath;
  img2.Save(imgPath2);
  ith.WriteImage(imgPath2, 80);
  </code></pre>
  
  <p>But this code gives me the error:</p>
  
  <blockquote>
    <p>Use of  unassigned local variable img2</p>
  </blockquote>
  
  <p>How can I solve this error?</p>