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.


Comments:

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 09:13 AM CEST #

Muy bueno

Posted by Vanhack on juin 26, 2009 at 10:45 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Sébastien Stormacq is a Senior Software Architect at Sun Microsystems. He uses his 15+ years of professional experience to design large scale, secured and highly transactional architectures based on Sun's middleware solutions.

Search

Archives
« avril 2014
lun.mar.mer.jeu.ven.sam.dim.
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today