简体   繁体   English

如何将HTML转换为TIFF图像?

[英]How can I convert HTML to TIFF images?

I am working on a project where I need to convert an HTML file to a TIFF image file format. 我正在开发一个项目,我需要将HTML文件转换为TIFF图像文件格式。 I know Java Imaging API exists, but from where I can download it for 64-bit JDK , and are there any tutorials for that? 我知道Java Imaging API存在,但我可以从64-bit JDK下载它,并且有任何教程吗? I read a lots of answers related to this on SO but still I am confused. 我在SO上阅读了很多与此相关的答案,但我仍感到困惑。 I just want a snippet of code to convert HTML or PDF or Excel to TIFF. 我只想要一段代码将HTML或PDF或Excel转换为TIFF。

You could use WebVector for HTML files - it converts a HTML page to PNG. 您可以将WebVector用于HTML文件 - 它将HTML页面转换为PNG。 The source is available and it should not be too difficult to change the PNG output to TIFF using the java imaging API: this question might be an inspiration. 源是可用的,使用Java Imaging API将PNG输出更改为TIFF应该不会太困难: 这个问题可能是一个灵感。

One process that I follow to resolve this is to transform your HTML to XSL-FO , then use Apache Fop to transform your output to an image format, such as PDF or TIFF. 我要解决此问题的一个过程是将HTML转换为XSL-FO ,然后使用Apache Fop将输出转换为图像格式,如PDF或TIFF。

The item that you would be missing is mapping HTML to FO, which could be done using XSLT, or via an app like HTML2FO . 您将缺少的项目是将HTML映射到FO,这可以使用XSLT或通过HTML2FO等应用程序完成

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM