djerdi
djerdi

Reputation: 77

Generating an .pdf file using data from text fields on form

I have no idea how to pull this one off. The problem is this, i will try to be as accurate as possible.

I have a form on which there are several text fields (there are also a combo box and 2 radio button groups, but let's focus on text fields) and two buttons on the bottom of the page - Save (into the db, which i know how to do) and Print form. My task is to create the pdf file (when Print is clicked) using the data that user inputed in text fields. Also, the printed pdf file should not look like bunch of random crap thrown around, but with some predefined style (with labels and tables where the data from fields will go).

Can someone give me a hint or a suggestion how to do this? I found that most people are reccomending iText library, but again, i don't know how to use it.

And let me point out that this is offline project, so no servlet is used, if that helps in any way. Thanks a lot in advance!

Upvotes: 2

Views: 1651

Answers (1)

Dan Herman
Dan Herman

Reputation: 1505

You can use Pdftk to generate the PDF from a PDF Form and fill in the fields with the fields from your form. This is how I've done it in the past. This way you have a nice formatted PDF with the data you need in the right places and don't have to mess around with iText and the plethora of options to make it look just right.

Here is a previous question on the topic Extract PDF form field names from a PDF form

Hope that helps.

Upvotes: 1

Related Questions