aspose file tools*
The moose likes Other Open Source Projects and the fly likes Create table rows dynamically after reading from pdf template Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Create table rows dynamically after reading from pdf template" Watch "Create table rows dynamically after reading from pdf template" New topic
Author

Create table rows dynamically after reading from pdf template

Michael Lai
Greenhorn

Joined: Nov 04, 2010
Posts: 1
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?
Bruno Lowagie
author
Ranch Hand

Joined: Oct 23, 2006
Posts: 88
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.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Welcome to Javaranch Michael Lai!


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Create table rows dynamically after reading from pdf template