引入依赖包

<dependency>
<groupId>net.sf.cssbox</groupId>
<artifactId>cssbox</artifactId>
<version>4.14</version>
</dependency>

案例:

public static void main(String[] args) throws Exception {
ImageRenderer render = new ImageRenderer();
render.setWindowSize(new Dimension(800, 1000), false);
System.out.println("kaishi");
String url = new File("G:/index.html").toURI().toString();
FileOutputStream out = new FileOutputStream(new File("G:"+ File.separator+"cssbox.png"));
Thread.sleep(10000);
render.renderURL(url, out, ImageRenderer.Type.PNG);
System.out.println("OK");
}

---------------------
作者:青春微凉love
来源:CSDN
原文:https://blog.csdn.net/qq_36029699/article/details/86507825
版权声明:本文为博主原创文章,转载请附上博文链接!

最新文章

  1. JS動態綁定下拉單內容
  2. hadoop2.6源码导入mvn出错Missing tools.jar问题解决方案
  3. WCF消息拦截,利用消息拦截做身份验证服务
  4. 线程池ExecutorService和完成服务CompletionService的使用获取线程的返回结果
  5. AngularJS开发指南9:AngularJS作用域的详解
  6. C/C++程序终止时执行的函数——atexit()函数详解
  7. 集群管理 secondaryNameNode和NameNode(转)
  8. How to using x++ creating Vendors [AX2012]
  9. 自定义的IntentFileter 无法找到activity
  10. 嵌入式C语言不可不用的关键字
  11. 一个简单的使用restc demo
  12. [HDU 2102] A计划(搜索题,典型dfs or bfs)
  13. ReentrantLock+线程池+同步+线程锁
  14. ③---Java项目管理工具MAVEN安装与配置
  15. sql server中的用户临时表和全局临时表的区别
  16. 两个有序数组的上中位数和第K小数问题
  17. ios 在使用 SDWebimage UIButton setBackgroundimage
  18. react脚手架改造(react/react-router/redux/eslint/karam/immutable/es6/webpack/Redux DevTools)
  19. HIT 2715 - Matrix3 - [最小费用最大流][数组模拟邻接表MCMF模板]
  20. git grade 版本下载及安装

热门文章

  1. struts2 动态Action
  2. C++笔记16之const的用法总结
  3. 组队作业_One
  4. HDU1301&amp;&amp;POJ1251 Jungle Roads 2017-04-12 23:27 40人阅读 评论(0) 收藏
  5. [label][javascript-Unit Test][JSLint]A Guide To JSLint Messages
  6. Excel2010画动态甘特图
  7. kubectl get componentstatus ERROR:HTTP probe failed with statuscode: 503
  8. 苹果appID的获取方法
  9. Verify the Developer App certificate for your account is trusted on your device.
  10. crond脚本执行并发冲突问题