0

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.

I have tried using a library for the purpose http://code.google.com/p/java-html2image/wiki/HtmlImageGenerator

My code using the above library is:

HtmlImageGenerator imageGenerator = new HtmlImageGenerator();
    imageGenerator.loadUrl("http://localhost:8080/scheduler/xxx")
    imageGenerator.getLinks();
    imageGenerator.saveAsImage("sos.png");

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.

Can someone help in the code or suggest any alternative libraries for the same?

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Nikhil Sharma
  • 2,221
  • 6
  • 25
  • 31

1 Answers1

0

How about using jQuery or java script, on googling a bit I found the following two existing posts in stackoverflow

generating a screenshot of a website using jquery

Take a screenshot of a webpage with JavaScript?

Community
  • 1
  • 1
Raju Rudru
  • 1,102
  • 12
  • 19