When we created the XMLWorker for iText®, we knew we’d have to write documentation. Emiel and I thought it would be nice if our documentation could be parsed to a PDF with the XMLWorker. HTML is currently the only supported XML format in the XMLWorker, hence we wrote it in HTML. We could have used DITA or Docbook format which would have required us to support those formats and study them, but that was/is not (yet) on the schedule. And for a library/framework like XMLWorker it’s a nice show off that it can parse it’s own documentation.
The HTML document we started writing initially took only 2 pages, but while adding stuff to it, it became longer and longer and the HTML file became a pain to maintain. On one evening I got fed up with that HTML file and wanted to split it into different HTML files. I needed to find a way to automagically parse these files to PDF.
Since I switched the itext build tools from ant to maven I thought: ‘wouldn’t it be nice if we could make a build of xmlworker and automatically have the documentation PDF created with it?’ Yes it would! And so I did. I created a maven plugin for us ‘itextdoc’ that parses an itextdoc XML file to PDF, and for the fun of it also transforms all those files to a site. ( A single HTML file or an ajax site, however those must be improved and are experimental.)
The maven plugin is currently not in the Central Maven Repository but I’m planning to upload it with the next release of XMLWorker.
However if you’d like to get a sneak peak you can clone the code from XMLWorkers git on sourceforge and build it yourself.
git://xmlworker.git.sourceforge.net/gitroot/xmlworker/itextdoc
To let it parse different HTML files to one PDF you have to register them in a doc.xml files which somehow follows the itextdoc.xsd. Take a look at the documentation to get a hint on the usage. Please note this is still under development!
Take a look at how it is done in XMLWorkerHelper.cs this should help you on your way.
Hello,
I’ve just downloaded XMLWorker 1.1.3 and am trying to convert HTML into PDF. However, I cannot find a working set of C#code to accomplish this. The Java examples seem to get me close, but always have some sort of twist when converted to C# that I can’t seem to overcome. Does anyone know where a correct working C# code example exists?