What is docbag

Docbag is an open source templating engine and a document generation library written in Java.

How it works

Docbag reads provided document template and creates a document out if it. It's that simple! During the process it evaluates all the potential embedded expressions and renders charts.

Currently the library can read xhtml template and create PDF / Postscript documents.

Main features


Docbag generates a single document in a fraction of second.


You can embed expressions into templates and docbag will evaluate them at runtime. See some examples here.


With docbag embedding charts into documents have never been easier! Chart example.

Thread safe

Docbag is thread-safe which means you can share templates and document creators across different threads without worrying about any concurrency issues.


A document is generated in a single method invocation without any state being saved in a generator. That means it scales horizontally and fits perfectly for any application including Web or Swing.