引入依賴包css
<dependency>
<groupId>net.sf.cssbox</groupId>
<artifactId>cssbox</artifactId>
<version>4.14</version>
</dependency>
案例:html
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
版權聲明:本文爲博主原創文章,轉載請附上博文連接!url