1. 程式人生 > >html轉圖片,java庫cssbox

html轉圖片,java庫cssbox

out Dimension 案例 setw ati version pid lov 鏈接

引入依賴包

<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
版權聲明:本文為博主原創文章,轉載請附上博文鏈接!

html轉圖片,java庫cssbox