iText library developer guide

Where to start if you need to develop on the iText library itself.

First, you’ll have to check out the source code from subversion. The svn root holds a couple of things so for itext itself do

svn co https://itext.svn.sourceforge.net/svnroot/itext/trunk/itext itext

this will checkout the itext core trunk. If you’d like geospatial and richmedia packages you also need to checkout xtra trunk

svn co https://itext.svn.sourceforge.net/svnroot/itext/trunk/xtra xtra

Continue reading “iText library developer guide”

XMLWorker Documentation

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!

iText®, XMLWorker and Maven

For the maven noobs!

 

How to add iText® in your pom dependencies

<dependency>
  <groupId>com.itextpdf</groupId>
  <artifactId>itextpdf</artifactId>
  <version>5.1.1</version>
  <type>jar</type>
</dependency>

How to add XMLWorker in your pom dependencies

<dependency>
  <groupId>com.itextpdf.tool</groupId>
  <artifactId>xmlworker</artifactId>
  <version>1.0.0</version>
  <type>jar</type>
</dependency>