title: Generate a png or jpeg image of a webpage using some java jar
body: <p>I have a Java EE application running and on one of its webpage, I want to add a functionality that whenever the user presses a certain button, I get an image of ONLY the webpage which is currently displayed on the user end.</p>
  
  <p>I have tried using a library for the purpose <a href="http://code.google.com/p/java-html2image/wiki/HtmlImageGenerator" rel="nofollow">http://code.google.com/p/java-html2image/wiki/HtmlImageGenerator</a> </p>
  
  <p>My code using the above library is:</p>
  
  <pre><code>HtmlImageGenerator imageGenerator = new HtmlImageGenerator();
      imageGenerator.loadUrl("http://localhost:8080/scheduler/xxx")
      imageGenerator.getLinks();
      imageGenerator.saveAsImage("sos.png");
  </code></pre>
  
  <p>It does generate an image but my page contains a lot of css and colors but the image which is generated does not seem to add that color and infact produces a blue screen with almost no css applied.</p>
  
  <p>Can someone help in the code or suggest any alternative libraries for the same?</p>