iText in Action

Creating and Manipulating PDF

Bruno Lowagie, Manning Publications Co. 2006

preorder now! Get a free chapter!

Running the examples in the book

If you are able to answer the magic question, you have access to an overview of all the book examples, organized per chapter. If you are successfully logged in, and you go to the examples of chapter 1, you see this overview (there are only two examples in the first introductory chapter):

  1. ant action -Dchapter=01 -Dexample=HelloWorld
    Resulting file:
  2. ant action -Dchapter=01 -Dexample=HelloWorldBurst
    Resulting files:

The first line is an ANT command line. You can run the example using the java command, but the benefit of using ANT, is that you don't need to worry about the CLASSPATH, compiling the code, using the correct working directory, and so forth. The action target (one of the targets defined in the build.xml file) takes care of this. All you need to do, is to provide the correct chapter number (01, 02, ..., 18) and the classname (HelloWorld) as demonstrated; for instance:

ant action -Dchapter=01 -Dexample=HelloWorld

A .class-file will be created somewhere in the bin directory. Resources will be fetched from the resources directory, and the result will appear in the results directory.

Let's have a closer look at the directory structure.

The directory structure

You can put the examples in any directory you want. Let's pretend we are working on Windows and that we keep all the source code related to this book in directory D:/itext-in-action/. This directory is more or less mirrored on itext.ugent.be/itext-in-action/

iText @ Ghent UniversityiText @ Ghent University
Related sites...

Contact | Home | Site Map | Print