Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to generate a PDF dynamically, having sections built on runtime?  RSS feed

 
Shalinee Gupta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have to create a PDF with details of an employee's family, and it has to be decided on runtime how many sections for dependents' information will be added. I am using i-text but the problem is coming while the decision making of adding sections for family members. Any ideas on how to do it?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is "the problem"?
 
Shalinee Gupta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem is.. I have a template, with sections: 'Employee Info', 'Spouse Info', 'Dependent1 Info', 'Dependent2 Info' etc
I need to add spouse and dependents in the final PDF only if their values are present, in case the employee does not have a family member, I don't want his section to be displayed with blank fields.
Since, I have to use existing template, so I am not creating the PDF manually (by adding paragraphs and sections). How to achieve this scenario?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to use existing template

This is important information. What kind of template are we talking about? Is it a pre-existing PDF in which your code is supposed to fill in values, or something else? How does the template relate to the process of creating the PDF?
 
Shalinee Gupta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, it is a pre-existing pdf template in which values will be filled using a map.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not aware of a way to add or remove sections of a PDF. You could reorganize the sections as a series of one-page PDFs, and add only those that you need to the final PDF.
 
Shalinee Gupta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Ulf. I was given the requirement in a different way to solve the problem, now I am not working on manipulating sections of an exiting PDF template, but working with fixed template pages and using xml configuration to select required pages on run time.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!