• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

generation of PDF files using .rtf template sample

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your quick reply. Do you have any idea, is this possible through iText?
 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think so.
 
Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic