引入依赖包

<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
版权声明:本文为博主原创文章,转载请附上博文链接!

相关文章:

  • 2021-04-07
  • 2022-12-23
  • 2021-05-06
  • 2021-06-14
  • 2021-12-19
  • 2021-12-19
  • 2022-12-23
  • 2021-05-08
猜你喜欢
  • 2022-12-23
  • 2022-01-29
  • 2021-08-23
  • 2022-12-23
  • 2022-02-07
  • 2021-12-19
  • 2021-06-23
相关资源
相似解决方案