使用Java将HTML文件转换为PDF及其图片和样式

使用Java将HTML文件转换为PDF及其图片和样式

问题描述:


可能重复:

将HTML文件转换为PDF

我想转换一个使用Java将HTML文件转换为PDF。我搜索了*和其他网站。我很惊讶。因为我找不到任何简单的方法。

I want to convert an HTML file to PDF by using Java. I've searched * and other sites. I am suprised. Because I couldn't find any easy way.

你可以帮我这么做吗?

Could you help me with to do that?

提前致谢。

如果没有Java库要做到这一点,我建议找一个命令行工具来完成这项工作,并使用Runtime.exec()从Java调用它。虽然不太理想。

If there is no Java library to do this, I suggest finding a command-line tool that does the job, and invoking it from Java using Runtime.exec(). Not ideal though.