title: iText image in java servlet
body: <p>I'm doing the letter generation with iText (pdf/rtf) in java servlet and got a problem with accessing images. The images are in the WebContent/images folder. When I run it in a local server and pointing the full path of images directory (c://eclipse/myproject/WebContent/images/letterHead.jpg) its working, but it fails running on the server with the directory ("WebContent/images/letterHead.jpg").</p>
  
  <p>The project is being deployed as a WAR on a tomcat server, thus ending up with an address similar to </p>
  
  <pre><code>http://someserver:8081/projectName/someJSP.jsp
  </code></pre>
  
  <p>I don't understand how to reference the images relatively in this environment, and any help would be much appreciated.</p>
  
  <p>Here is my code</p>
  
  <pre><code>Image imghead = Image.getInstance("WebContent/images/letterHead.jpg");
  imghead.setAbsolutePosition(35,770);
  imghead.scaleAbsolute(125, 42);
  document.add(imghead);
  </code></pre>