Click to See Complete Forum and Search --> : Dynamically populating pdf forms


llama
04-05-2004, 06:21 AM
Hi all,

I have a pdf form that I would like to dynamically populate with data received from an HTML form. Any suggestions for the easiest/quickest/most reliable way to do this?

Many thanks

Stephen

shimon
04-05-2004, 10:21 AM
There are certainly ways you can manipulate pdf files in PHP. There's the pdflib_* functions which need to be compiled in, and aren't actually free (last time i looked) or FPDF (http://www.fpdf.org/?lang=en) which is free and doesnt require compilation

I haven't really used either so I dont know if they do what you want, but it's a starting point...best of luck :)

llama
04-06-2004, 03:09 AM
Thanks Shimon,

These libraries are probably overkill though. I don't need to create new pdfs, or even modify them, just populate form fields.

There must be a way of doing this?

Stephen

shimon
04-06-2004, 10:10 AM
ahh

i admit i didnt know that pdfs can have form fields...i wonder, do you have an example of something like it online, so i can get a better idea of this?

sneakyimp
04-06-2004, 01:05 PM
where can you find pdflib?

llama
04-07-2004, 03:24 AM
An example of a pdf form can be found here:

www.planetpdf.com/planetpdf/pdfs/jkingFormsTut.pdf (http://www.planetpdf.com/planetpdf/pdfs/jkingFormsTut.pdf)

pdflib can be found here
http://www.pdflib.com/

cheers

Stephen

shimon
04-07-2004, 04:26 AM
hmm interesting stuff, seems to have some sort of javascript-like thing going on there. You could presumably use php to generate that javascript, but I dont really know whether it allows the script to be external to the pdf document, i didnt read that far ;)

Fwiw, that form doesn't actually work for me since I don't have the required plugin, apparently, so I guess you couldn't rely on anyone else having it either. Interesting challenge though...

llama
04-07-2004, 04:35 AM
I don't need the pdf to be as complicated as the example I gave you - no JavaScript required. I just need to get values into the form fields...

shimon
04-07-2004, 04:59 AM
fair enough - it's just the way i interpreted this document, it seemed to suggest that that would be a way you could populate those fields, like

myfield.value="Some text here"

and I was thinking that if somehow you could generate that javascript using PHP, you'd be well on your way to a solution:echo "myfield.value='".$myvalue."';";but i may be getting confused, this is pretty new to me, and i haven't had a lot of coffee yet today...