This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Generation of Dynamic PDF/Word doc from the template

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All.

After a long time here in this forum  

I am looking for a kind of solution where we have to dynamically generate pdf or word document based on some parameters using some predefined template. Now I need some suggestion, how to go ahead and attack the problem.
What I understand is to convert the template into a XML and then parse the XML and generate the PDF with the dynamic values on the run time. Please help me here with your suggestion or approach.

Thanks in advance
Samrat
 
Saloon Keeper
Posts: 5882
147
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are various ways to tackle this, and it's hard to recommend one over the other given the lack of detail. You could use FlyingSaucer library to render CSS-styled XHTML or XML as PDF. Or, if you have highly regular data in XML form, you could use Apache FOP to render it to PDF using an XSL-FO stylesheet. If the data is rather irregular, writing code using the iText or PDFBox APIs to create PDFs would be an option.

Alternatively, you can create RTF templates and search-and-replace placeholders in that. RTF can be opened by just about any wordprocessor, so is a good substitute for actual Word files (which are much harder to create).
 
I promise I will be the best, most loyal friend ever! All for this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!