Using OpenOffice API to generate PDF documents
Based on my previous blog entry, I applied the same technique to programmatically generate PDF documents.
The sample NetBeans project is available for you to download.
This sample does the following :
- It creates an empty text document (using OO's writer application)
- It inserts the content of a template (another document containing text, images, etc ...)
- It searches and replaces occurences of tags (like @name@) with actual data
- It saves the resuting document as PDF
Using this technique, you can generate professional looking PDF documents from your Java application using only free and open-source softwares.
This was tested on Mac OS X, with Apple's Java 6 and StarOffice 9 Beta. Enjoy !
As usual, I welcome your comments and feedbacks.

Hi,
Your writer to PDF blog looks good. But I need to do some more. We want to do the same thing, but here we have "N" # of data sets available, we would like generate 'N' set into the same document.
Please suggest some solution using open office, I tried mail mereger but it is not working.
Posted by KAPIL DHAKAD on septembre 04, 2008 at 04:13 PM CEST #
Muy bueno
Posted by Vanhack on juin 27, 2009 at 05:45 AM CEST #