标签:
//java Html2Image 实现html转图片功能
// html2image
HtmlImageGenerator imageGenerator = new HtmlImageGenerator();
String htmlstr = "<table width=‘654‘ cellpadding=‘0‘ cellspacing=‘0‘ bordercolor=‘#FFFFFF‘><tr><td><img src=‘http://www.apkfather.com/yhqserver/images/mdl.jpg‘/></td><td><img src=‘http://www.apkfather.com/yhqserver/images/mdl.jpg‘/></td><td><img src=‘http://www.apkfather.com/yhqserver/images/mdl.jpg‘/></td></tr><tr><td><img src=‘http://www.apkfather.com/yhqserver/images/mdl.jpg‘/></td><td><img src=‘http://www.apkfather.com/yhqserver/images/mdl.jpg‘/></td><td><img src=‘http://www.apkfather.com/yhqserver/images/mdl.jpg‘/></td></tr><tr><td><img src=‘http://www.apkfather.com/yhqserver/images/mdl.jpg‘/></td><td><img src=‘http://www.apkfather.com/yhqserver/images/mdl.jpg‘/></td><td><img src=‘http://www.apkfather.com/yhqserver/images/mdl.jpg‘/></td></tr><tr><td><img src=‘http://www.apkfather.com/yhqserver/images/mdl.jpg‘/></td></tr></table>";
imageGenerator.loadHtml(htmlstr);
imageGenerator.getBufferedImage();
imageGenerator.saveAsImage("d:/hello-world.png");
imageGenerator.saveAsHtmlWithMap("hello-world.html", "hello-world.png");
// html2image api介绍
标签:
原文地址:http://www.cnblogs.com/zxf330301/p/5666592.html