网页缩略图生成类库 Scrender
jopen
13年前
<p>Scrender是一个用来生成网页缩略图的Java类库,基于SWT开发。它实质上是调用本地浏览器引擎对要进行截图的网站进行渲染,然后保存该网页的缩略图。</p> <p>示例代码:</p> <pre class="brush:java; toolbar: true; auto-links: false;">package net.dapper.scrender.examples; import java.io.File; import net.dapper.scrender.Scrender; /** * @author Ohad Serfaty */ public class RendererExample { public static void main(String[] args) throws Exception { // Create a standard self-disposing scrender object : Scrender scrender = new Scrender(); scrender.init(); // render it ( and dispose when finish): scrender.render("http://www.open-open.com", new File("./open.index.html.jpg")); // Creae a second scrender object , one that is continuous ( meaning , you can make all the screenshots // you want but you have to dispose it yourself ) Scrender scrender2 = new Scrender(true); scrender2.init(); scrender2.render("http://www.google.com", new File("./google.com.jpg")); scrender2.render("http://www.yahoo.com", new File("./yahoo.com.jpg")); scrender2.dispose(); } }</pre> <br /> <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1324432593624" target="_blank">http://www.open-open.com/lib/view/home/1324432593624</a></p> <p></p>