如何在 Java 中从 XML 创建 PDF? [英] How do you create a PDF from XML in Java?
问题描述
目前,我正在用 Java 创建一个 XML 文件,并通过使用 XSL/XSLT 对其进行转换将其显示在 JSP 页面中.现在我需要获取该 XML 文件并在 PDF 中显示相同的信息.有没有办法通过使用某种 XSL 文件来做到这一点?
At the moment, I'm creating an XML file in Java and displaying it in a JSP page by transforming it with XSL/XSLT. Now I need to take that XML file and display the same information in a PDF. Is there a way I can do this by using some kind of XSL file?
我看过 iText Java-PDF 库,但我找不到任何方法将其与 XML 和样式表一起使用.
I've seen the iText Java-PDF library, but I can't find any way to use it with XML and a stylesheet.
任何帮助将不胜感激.提前致谢!
Any assistance would be much appreciated. Thanks in advance!
推荐答案
您可以使用 XSL 格式化对象.这里有一些关于如何做到这一点的好文章:
You can use XSL Formatting objects. Here are some good articles on how to do it:
- http://www.xml.com/pub/a/2001/01/17/xsl-fo/index.html
- http://www.xml.com/pub/a/2001/01/24/xsl-fo/index.html?page=1
- http://www.javaworld.com/javaworld/jw-04-2006/jw-0410-html.html
这篇关于如何在 Java 中从 XML 创建 PDF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!