Is there any documents and reference source codes for iText 5.0.3 (especially for HTMLWorker) ?
iText 5.0.3是否有任何文档和参考源代码(特别是对于HTMLWorker)?
Another question is in iText 5.0.3, HTMLparser is obsoleted ?
另一个问题是在iText 5.0.3中,HTMLparser已经过时了吗?
2 个解决方案
#1
0
In 5.0.3 HTMLWorker exists, but does not support a lot of CSS. there is an example that converts movie xmls to pdf on the itextpdf.com examples pages.
在5.0.3中存在HTMLWorker,但不支持很多CSS。有一个示例可以在itextpdf.com示例页面上将影片xmls转换为pdf。
With the next release of iText (5.1 or 5.0.7 not sure what it will be) there will be a separate jar the XMLWorker that will provide much more CSS support.
随着iText的下一个版本(5.1或5.0.7不确定它将是什么),将有一个单独的jar,XMLWorker将提供更多的CSS支持。
#2
0
Not sure about the iText part, but you can also use FlyingSaucer to convert HTML to PDF. Here's a simple blog with a bunch of examples.
不确定iText部分,但您也可以使用FlyingSaucer将HTML转换为PDF。这是一个包含大量示例的简单博客。
For example HTML to PDF is as easy as:
例如,HTML到PDF就像:
ITextRenderer renderer = new ITextRenderer();
renderer.setDocument(new File("/file.html"));
renderer.layout();
renderer.createPDF(new FileOutputStream("/file.pdf"), true);
Note that it actually requires well formed XML. So you really need to feed it with XHTML. You can if necessary use an arbitrary HTML parser which produces a org.w3c.dom.Document
which you in turn can feed to ITextRenderer#setDocument()
so that you can convert tagsoups to PDF as well.
请注意,它实际上需要格式良好的XML。所以你真的需要用XHTML来喂它。如果需要,您可以使用生成org.w3c.dom.Document的任意HTML解析器,然后您可以将其提供给ITextRenderer #setDocument(),以便您也可以将tagsoups转换为PDF。
See also
- FlyingSaucer full user guide
- FlyingSaucer full Javadoc
FlyingSaucer完整的用户指南
FlyingSaucer完整的Javadoc
#1
0
In 5.0.3 HTMLWorker exists, but does not support a lot of CSS. there is an example that converts movie xmls to pdf on the itextpdf.com examples pages.
在5.0.3中存在HTMLWorker,但不支持很多CSS。有一个示例可以在itextpdf.com示例页面上将影片xmls转换为pdf。
With the next release of iText (5.1 or 5.0.7 not sure what it will be) there will be a separate jar the XMLWorker that will provide much more CSS support.
随着iText的下一个版本(5.1或5.0.7不确定它将是什么),将有一个单独的jar,XMLWorker将提供更多的CSS支持。
#2
0
Not sure about the iText part, but you can also use FlyingSaucer to convert HTML to PDF. Here's a simple blog with a bunch of examples.
不确定iText部分,但您也可以使用FlyingSaucer将HTML转换为PDF。这是一个包含大量示例的简单博客。
For example HTML to PDF is as easy as:
例如,HTML到PDF就像:
ITextRenderer renderer = new ITextRenderer();
renderer.setDocument(new File("/file.html"));
renderer.layout();
renderer.createPDF(new FileOutputStream("/file.pdf"), true);
Note that it actually requires well formed XML. So you really need to feed it with XHTML. You can if necessary use an arbitrary HTML parser which produces a org.w3c.dom.Document
which you in turn can feed to ITextRenderer#setDocument()
so that you can convert tagsoups to PDF as well.
请注意,它实际上需要格式良好的XML。所以你真的需要用XHTML来喂它。如果需要,您可以使用生成org.w3c.dom.Document的任意HTML解析器,然后您可以将其提供给ITextRenderer #setDocument(),以便您也可以将tagsoups转换为PDF。
See also
- FlyingSaucer full user guide
- FlyingSaucer full Javadoc
FlyingSaucer完整的用户指南
FlyingSaucer完整的Javadoc