March 18, 2018

ODT to PDF using XDocReport and Apache Freemarker

XDocreport is an open-source Java library designed to merge and combine templates with a data model. XDocReport supports both Velocity and Freemarker as template engine and allows you to convert the finished document into PDF or XHTML format. Templates are just regular documents, created using Microsoft Word or LibreOffice, with added placeholders for any dynamic content. In this post I show how to merge a data source coming from a simple Java Pojo with an ODT Freemarker template. The finished document will be a PDF file, generated by using the built-in XDocReport converter.


JDK 1.8
Maven 3.5.9
Opensagres XDocReport 2.0.1
Apache Freemarker 2.3.23


svn co java-utilities
git clone

Customer POJO


ODT Freemarker Template

Use LibreOffice Writer to create the ODT template. Input fields are defined according to the Freemarker syntax.

XDocReport Engine

Main Executor



Related posts

Leave a Reply

Your email address will not be published.