filling in PDF form with Java?

A

abc

Hi,

I'm intereted in creating a small app that will gather info from a user and then use it to fill in a predefined
form this is in pdf format. My initial thought it to scan a printout of the form and then read the file, write
the appropriate fields at the pixel level and then write out the modified image. This seems tedious both in
terms of my time - figuring out the size and location of fields in pixels - and in terms of what the program
will need to do. Before I go reinventing the wheel I thought I'd check to see if anyone has seen a better
solution (a package/api for writing to pdf forms perhaps?) or maybe even has some example code...? Thanks in
advance!
 
A

Ann

Hi,

I'm intereted in creating a small app that will gather info from a user
and then use it to fill in a predefined
form this is in pdf format. My initial thought it to scan a printout of
the form and then read the file, write
the appropriate fields at the pixel level and then write out the modified
image. This seems tedious both in
terms of my time - figuring out the size and location of fields in
pixels - and in terms of what the program
will need to do. Before I go reinventing the wheel I thought I'd check to
see if anyone has seen a better
solution (a package/api for writing to pdf forms perhaps?) or maybe even
has some example code...? Thanks in

Sounds fast to me, all you need is a ruler. Faster than
trying to get someone else to program it.
 
A

abc

and then use it to fill in a predefined
the form and then read the file, write
image. This seems tedious both in
pixels - and in terms of what the program
see if anyone has seen a better
has some example code...? Thanks in

Sounds fast to me, all you need is a ruler.

If there was a single page with a few entries that would be true but there are several pages of forms with
dozens of entries per page.
Faster than
trying to get someone else to program it.

Excuse me?
 
A

abc

Has been done before. Use google and keywords such as 'pdf java forms'.

Hi and thanks for the response... yes I did that. Perhaps I shouldn't have used the word form. I was using it in
the colloquial sense - that if you printed the document out it looks like a form; unfortunately it is not a form
in the pdf sense - it was created simply to produce hardcopy of an existing form - so none of the pdf form
functions are used. There were alot of entries erturned by google so I was skimming but everything I saw looked
like it would require the pdf set up to have text fields designed to be filled in... but like I said I was
necessarily skimming so perhaps I missed something.
 
W

Wendy S

I'm intereted in creating a small app that will gather info from a user
and then use it to fill in a predefined
form this is in pdf format. My initial thought it to scan a printout of
the form and then read the file, write
the appropriate fields at the pixel level and then write out the modified
image. This seems tedious both in
terms of my time - figuring out the size and location of fields in
pixels - and in terms of what the program
will need to do. Before I go reinventing the wheel I thought I'd check to
see if anyone has seen a better
solution (a package/api for writing to pdf forms perhaps?) or maybe even
has some example code...? Thanks in

Take a look at iText, I think it has a "PDF Stamper" that does what you're
asking for.
 
A

abc

If you started yesterday, you would be finished by now.

You have no idea whether that is the case or not.
But you still don't have a program to do it for you, do you?
(Me thinks you are lazy.)

Hmmm, well I think that you know nothing about me. To your initial baseless accusation that I'm "trying to get
someone else to program it" you have now added another insult. I have no idea what you are really like but you
present yourself as an arrogant and insulting person with little or nothing to contribute but with sufficient
time on your hands to waste it insulting complete strangers. Such behavior is usually the preserve of the very
young or very insecure as is the use of archaic language to attempt the appearance of wisdom or intellectual
competence. The appropriate response to someone like that is this:
*plonk*

Have a nice life.
 
A

abc

and then use it to fill in a predefined
the form and then read the file, write
image. This seems tedious both in
pixels - and in terms of what the program
see if anyone has seen a better
has some example code...? Thanks in

Take a look at iText, I think it has a "PDF Stamper" that does what you're
asking for.

Hi Wendy - thanks for the pointer!
 
A

Ann

You have no idea whether that is the case or not.

.... My initial thought it to scan a printout of the form and then
read the file, write the appropriate fields at the pixel level
and then write out the modified image....

Did the requirements change?
 
K

Kees

Hi,

I'm intereted in creating a small app that will gather info from a user and then use it to fill in a predefined
form this is in pdf format. My initial thought it to scan a printout of the form and then read the file, write
the appropriate fields at the pixel level and then write out the modified image. This seems tedious both in
terms of my time - figuring out the size and location of fields in pixels - and in terms of what the program
will need to do. Before I go reinventing the wheel I thought I'd check to see if anyone has seen a better
solution (a package/api for writing to pdf forms perhaps?) or maybe even has some example code...? Thanks in
advance!

Take a look at itext!

Kees.
 
T

thisone_23

Yes, someone else jsut suggested that to me - thanks for the pointer!

Hi, I actually work for a company that has a product that sounds like
it will do exactly what you are looking for. The name of the company
is ceTe Software and the product you would need to use is DynmaicPDF
Merger for Java, http://www.cete.com/Products/MergerForJava/. One of
the things that Merger allows you to do is take an existing PDF and
programatically fill it in with dynamic data (in your case the data
gathered from the user).

Merger gives you a couple options for filling out your PDF. If your
existing PDF contains Acrobat form fields, then you can reference those
form fields directly by name to fill in the values, for example:

document.getForm().getFields().getFormField("TextBox1").setValue("My
Text");

If your existing PDF is not filled with Acrobat form fields then you
can still place all your dynamic content on the PDF using our
coordinate system:
Label objLabel = new Label(strText, x, y, width, height,
Font.getHelvetica(), size, TextAlign.CENTER);

After adding the content to the PDF, Merger also gives you option like
the ability to set the form fields to read only, or even flatten the
form fields all together. Also is the ability to set 128 bit
encryption on the document to assure nothing on the document is edited.

Check it out and see if it helps.
 
R

Real Gagnon

I'm intereted in creating a small app that will gather info from a
user and then use it to fill in a predefined form this is in pdf
format. My initial thought it to scan a printout of the form and then
read the file, write the appropriate fields at the pixel level and
then write out the modified image. This seems tedious both in terms of
my time - figuring out the size and location of fields in pixels - and
in terms of what the program will need to do. Before I go reinventing
the wheel I thought I'd check to see if anyone has seen a better
solution (a package/api for writing to pdf forms perhaps?) or maybe
even has some example code...? Thanks in advance!

A better solution is to use the FDF (Forms Data Format ) mechanism.

Short tutorial at http://www.15seconds.com/issue/010822.htm

Adobe provides a Java API too.

Bye.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top