This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Joe Ess
  • salvin francis
  • fred rosenberger

Create table rows dynamically after reading from pdf template

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's my situation:

I have some a pdf that contains a table with several rows, with each row containing an acroform textfield. In my program, I have a reader that reads this form and then a PdfStamper that will fill in data into these textfields.

However, what I don't know is how to add more rows (with textfields) to the table if I still have more data. I realize that I can create a table and its rows programmatically using PdfPTable. But ideally, what we would like to do, is to create pdf snipplets of different tables for various reports. For example, my designer can create a pdf that contains table x to be used for report 1, table y for report 2, and so forth. We would like to create these tables using OpenOffice and then in my program, I just load the corresponding pdf table snipplet for report x.

Of course, the designer cannot anticipate how much data there will be, so I have to be able to add/remove rows dynamically to the table. So my question is, is there a way to recognize that the snipplet I've read is a table?

If the above answer is no, then perhaps what I can do is have a pdf containing a row snipplet (with textfields) and dynamically add that to the document? Would that work as well?
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You want to create the form using Open Office. This means you are creating a form using AcroForm technology. AcroForm technology means: you are creating static forms.
However, based on your description, you say you want dynamic forms. That's in contradiction with the choice you made above, because real dynamic forms can only be created using XFA technology.

Your question isn't one that can be answered in the text box of a forum. You need somebody to analyze your specific requirements and create an architecture/design for you.

I know of projects where PDF snippets were used to create a PDF (with pop-quiz questions for University Students who want to do a self-evaluation). I know of projects where XFA is used to create a dynamic form (but when using iText you can only fill such forms, not flatten them). I know of projects where somebody used AcroForms in a creative way to solve a similar problem.

You (or your developers) will have to study the different options (AcroForm or XFA? PDF template or XML temlate?) and choose the solution that offers the best match for your needs. Personally, I think creating a tabular form in Open Office and then try to add rows (with iText or with any other tool) isn't an elegant solution.
Posts: 3281
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to Javaranch Michael Lai!
I will open the floodgates of his own worst nightmare! All in a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!