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.
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.
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: