tags:

views:

66

answers:

1

Is there any documents and reference source codes for iText 5.0.3 (especially for HTMLWorker) ?

Another question is in iText 5.0.3, HTMLparser is obsoleted ?

A: 

The HTML parser/renderer part of iText has been splitted into FlyingSaucer. It's unclear what exactly you're asking for, so here's just a simple blog with a bunch of examples.

For example HTML to PDF is as easy as:

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.

See also

BalusC