简体   繁体   English

iText 5.0.3是否有任何参考源代码或文档?

[英]Any reference source codes or documents for iText 5.0.3?

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被淘汰了吗?

Not sure about the iText part, but you can also use FlyingSaucer to convert HTML to PDF. 不确定iText部分,但您也可以使用FlyingSaucer将HTML转换为PDF。 Here's a simple blog with a bunch of examples . 这是一个带有大量示例简单博客

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. 请注意,它实际上需要格式正确的XML。 So you really need to feed it with XHTML. 因此,您确实需要使用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. 如有必要,可以使用任意的HTML解析器产生一个org.w3c.dom.Document ,你又可以喂到ITextRenderer#setDocument()这样就可以tagsoups转换为PDF格式为好。

See also 也可以看看

In 5.0.3 HTMLWorker exists, but does not support a lot of CSS. HTMLWorker在5.0.3中存在,但不支持很多CSS。 there is an example that converts movie xmls to pdf on the itextpdf.com examples pages. 在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)中,将有一个单独的XMLWorker jar,它将提供更多的CSS支持。

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

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