将HTML转化作Image
将HTML转化为Image下载http://code.google.com/p/java-html2image/downloads/listjar包HtmlImageGenerator
将HTML转化为Image
下载http://code.google.com/p/java-html2image/downloads/listjar包
HtmlImageGenerator imageGenerator = new HtmlImageGenerator();imageGenerator.loadHtml("<b>Hello World!</b> Please goto <a title="Goto Google" href="http://www.google.com">Google</a>."); imageGenerator.saveAsImage("hello-world.png"); imageGenerator.saveAsHtmlWithMap("hello-world.html", "hello-world.png");
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 <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 <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.