Skip to content

johnbhurst/pdf-builder

Repository files navigation

pdf-builder

This is a Groovy PDF builder that uses the iText library to generate PDF documents.

Note: As of the end of 2009, the iText 5.x code base switched to the Affero General Public License.
This license is likely to be unsuitable for many projects.
Thus, this pdf-builder project targets the iText 2.x code base, which uses the more liberal Mozilla Public License.
Note that the iText 5.x code base is source-incompatible with iText 2.x: package names have been changed from com.lowagie to com.itextpdf, classes have been moved/removed/changed.
Be sure to refer to the iText 2.x documentation when using pdf-builder.

The project is inspired by the groovy-pdf project, but contains all new code.

Currently the code is under development, and still in a very much alpha state.
However, we are already using it for some projects under development at a client.

There are some examples, including Groovy versions of many of the iText examples, in the examples/ directory.

We hope to follow up soon with:

  • Documentation
  • Samples
  • More features
  • More tests
  • Maven artifacts

Here’s a Hello World from pdf-builder:


import nz.co.skepticalhumorist.pdfbuilder.PDFBuilder

new PDFBuilder(new FileOutputStream(“Hello.pdf”)).document() {
paragraph(“Hello from iText.”)
}

Running tests

(TBD: Move to another page.)

To run all of the tests, you need some prerequisites:

  • iText examples (for data and images)
  • Windows fonts

Get the iText examples from the SourceForge SVN repository, using a command like this:


svn co https://itext.svn.sourceforge.net/svnroot/itext/examples itext-examples

If you are running Windows, you should have the necessary fonts.
Otherwise, you need to get these files and place them in a directory on your system:

  • arbli___.ttf
  • arialbd.ttf
  • arialbi.ttf
  • ariali.ttf
  • arial.ttf
  • comicbd.ttf
  • comic.ttf
  • msgothic.ttc

Finally, you need to configure these locations in ~/.gradle/gradle.properties, e.g.:


pdfBuilderITextExamplesHome = /home/user/pdf-builder/itext-examples
pdfBuilderWindowsFontLocation = /home/user/pdf-builder/windows-fonts

About

Groovy PDF Builder for iText 2.x

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages