It's not a secret anymore!*
The moose likes Other Open Source Projects and the fly likes generation of PDF files using .rtf template sample Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "generation of PDF files using .rtf template sample" Watch "generation of PDF files using .rtf template sample" New topic
Author

generation of PDF files using .rtf template sample

Bindu Padmanabhan
Greenhorn

Joined: Jun 13, 2008
Posts: 10

Hi,

I am working on an application, where i need to generate PDF files to send out to the users.

I have a sample .rtf file, which is the template for the PDF files. This template is actually a letter format, in which the fields like name, address, license number etc are marked as @name@, @address@ etc. I have to generate pdf files( actually letters to the users) replacing @name@ ,@address@ etc with the real time name ,address from the database.

Can i use iText API for this? or PDFBox ? I googled but couldn't find much useful info.

Appreciate your advices.

Thanks in advance.
Bindu
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Check out JODConverter - it uses OpenOffice in server mode to convert between various formats; it should be handle RTF to PDF. The text replacement before that can be done using a tool like sed.
Bindu Padmanabhan
Greenhorn

Joined: Jun 13, 2008
Posts: 10
Thanks for your quick reply. Do you have any idea, is this possible through iText?
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Sure it's possible. But you'd essentially be writing a RTF-2-PDF converter on your own - that's a LOT of work.
Bindu Padmanabhan
Greenhorn

Joined: Jun 13, 2008
Posts: 10
Thanks a lot, Tim . So you think JODConverter is the best option? And is the tool 'sed' is integrated with the JODConverter?
And are these 2 opensource??
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
We don't know enough about the circumstances to say what might be the best option; it's what I would check out first.

sed is a tool that's installed on every Unix system in existence; it has nothing to do with JODConverter. Look up its Wikipedia page for the basic facts. But string replacement is easy - you can use any approach you like, including writing your own Java code, or using a Java framework like Velocity or FreeMarker.
Bindu Padmanabhan
Greenhorn

Joined: Jun 13, 2008
Posts: 10
Thanks for your patience in answering my questions. I also think Freemarker is a good choice in placeholder replacement.
Let me try with freemarker and JODConverter. Thanks
Bindu Padmanabhan
Greenhorn

Joined: Jun 13, 2008
Posts: 10
One more quick question. I googled about the use of freemarker. It mainly replaces the placeholders inside ${} . I am wondering whether it can replace strings inside @ @??

Thanks in advance
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
I don't think so.
 
wood burning stoves
 
subject: generation of PDF files using .rtf template sample
 
Similar Threads
converting PDF to xml using JasperReport or Apache FOP
What PDF product would you recommend for ...
Generate dynamic word document from jsp
Convert rtf File to jpg File
Transform XML to RTF