Get it

Get the full distribution (920 KB, contains all you need excluding ant) or get the pure source code (91 KB, source code and examples only)

The source code is covered by the Apache license.

Use it


Ant task to create several document formats out of xml files using the iText framework.

It can be used to create your documentation in several output formats from one source. Currently iText supports PDF (default), HTML and RTF. It also supports your own tag maps, headers and footers. The distribution contains some examples token from the iText website. This site contains also an excellent tutorial.


You need to put the jar files (itext.jar, itext-xml.jat, itexttask.jar) in into the lib direcory of ant. Then you have to register the itext task in your build file.
		<available property="iTextTask.present"
	<target name="tdef" depends="prepare" if="iTextTask.present">		
		<taskdef name="iText" classname=""/>


The Task has the following attributes:

Attribute Description Required
dest Where to place the generated file. The ending of the file is not taken into account. Yes
srcdir Input file (XML file) to parse. File must exist Yes
format Desired output format ('pdf', 'html' or 'rtf'. Default is 'pdf' No
tagmap Tag map to use No
header Header for every page (PDF only) No
footer Footer for every page. Use 'pagenumbering', if you like to have the page numbers in the footer (PDF only) No


Builds a pdf document without tag map out of plain.xml. Every page contains a header 'My header', the footer 'Page x of y'.
			header ="My header"
			footer ="pagenumbering"
Builds a html document out of WithTags.xml with tag map TagMap.xml. Every page has a footer 'My footer'.
			footer ="My footer"
Builds a rtf document out of WithTags.xml with tag map TagMap.xml. Pages have neither a footer nor a header.


This task is currently not part of the ant distribution, but should obey to their rules. Some of the test cases won't work at this moment, due to problems with the XML parser. Running this task like described above should work fine.