html页面带有js,生成的pdf应是加载完全的html页面效果,有没有实现方法
1、java的版本https://github.com/timendum/pdf2html
2、JavaScript版本https://github.com/Xportability/css-to-pdf
实现HTML转PDF的功能,也可以试试[https://www.e-iceblue.cn/Introduce/Spire-PDF-JAVA.html](**Spire.PDF for Java**)控件,代码操作简单,转换效果很好,参考代码如下:
```java
import com.spire.pdf.graphics.PdfMargins;
import com.spire.pdf.htmlconverter.qt.HtmlConverter;
import com.spire.pdf.htmlconverter.qt.Size;
public class HtmltoPDF {
public static void main(String[] args) {
//定义需要转换的HTML
String url = "https://www.e-iceblue.cn/";
String fileName = "Result.pdf";
//设置插件本地地址
String pluginPath = "D:/Qt/plugins_32";
HtmlConverter.setPluginPath(pluginPath);
//转换到PDF并设置PDF尺寸
HtmlConverter.convert(url, fileName, true, 1000000, new Size(600f, 900f), new PdfMargins(0));
}
}
```