网页缩略图生成类库 Scrender
<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>
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!