Html2Image as only one useful Java class, HtmlImageGenerator.
Common usage is this: {{{ HtmlImageGenerator imageGenerator = new HtmlImageGenerator(); imageGenerator.loadHtml("Hello World! Please goto <a title="Goto Google" href="http://www.google.com\">Google."); imageGenerator.saveAsImage("hello-world.png"); imageGenerator.saveAsHtmlWithMap("hello-world.html", "hello-world.png"); }}}
Which will generate hello-world.png image of the HTML and hello-world.html file containing client-side image-map {{{}}} (as in the example above).
=== HtmlImageGenerator Methods ===
-
loadUrl(url) - Loads HTML from URL object or URL string.
-
loadHtml(html) - Loads HTML source.
-
saveAsImage(file) - Save loaded HTML as image.
-
saveAsHtmlWithMap(file, imageUrl) - Creates an HTML file containing client-side image-map {{{}}} generated from HTML's links.
-
getLinks() - List all links in the HTML document and their corresponding href, target, title, position and dimension.
-
getBufferedImage() - Get AWT buffered image of the HTML.
-
getLinksMapMarkup(mapName) - Get HTML snippet of the client-side image-map {{{}}} generated from the links.
-
get/setOrientation(orientation) - Get/Set document orientation (left-to-right or right-to-left).
-
get/setSize(dimension) - Get/Set size of the generated image.