itextdoc 2.0.0

itextdoc has been updated to version 2.0.0

2.0.0 introduces a code styler module. This module styles Java code by colouring it like in your IDE.

By adding the attribute code=”java” to a tag, the inner text is seen as Java code. It is even possible to include a file through a new tag.

The <codepart> tag.

With the codepart tag you can designate a file that will not be seen as html and hence will not be parsed as such but for example as Java code a.

<codepart file="SomeKlass.java" code="java"/>

will do the trick.

see here for itextdoc usage and some background info

XMLWorker Documentation ( itextdoc )

As promised after the release of iText and XMLWorker, there would be a release of itextdoc. Our project to parse our own documentation for the XMLWorker with the XMLWorker.

The itextdoc maven plugin is now available from Maven Central. To use it in your build cycle of a project add

<plugin>
   <groupId>com.itextpdf.maven</groupId>
   <artifactId>itextdoc</artifactId>
   <version>0.1.0</version>
   <executions>
    <execution>
      <phase>package</phase>
      <goals>
         <goal>create</goal>
      </goals>
      <inherited>false</inherited>
    </execution> 
   </executions>
</plugin>

What does it do and how can you use it?

itextdoc transforms html to PDF with iText and XMLWorker. Optionally you can transform the html to a styled website but that’s still under construction.

By default the plugin looks for a folder itextdoc under the src folder. Easily configure another folder by adding a configuration to the executuion.

<configuration>
  <flatsite>true</flatsite> // enable generation of a site
  <site>true</site> // enable generation of a javascript driven site
  <src>src/doc</src> // change default source directory
  </configuration>

Currently only a doc.xml file is accepted as the xml file wherein you define the different html files (or one) and your CSS file.

The result is something like this. The initial documentation for itext doc, not styled with custom css.

To create a website use the site and flatsite configuration parameters. But the site generation is not yet fully functioning.

Where to request features and report bugs?

At sourceforge features, bugs.

Other links
check for latest version
Ohloh
iText

Note: don’t forget iText, XMLWorker are AGPL.

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!

%d bloggers like this: