I'm trying to set up a database of loan agreements, where users will submit a form through Acrobat and their information will be stored in a mySQL database. Later, they can go back and download the PDF, which will be repopulated with their data in the mySQL db.
I made the form in Livecycle Designer and submit the information through HTTP POST. I can easily get the information from the form into the database...my only problem is getting that information back out into the PDF.
What would allow me to write back to the PDF, preferably using PHP? What kind of syntax would that require?
I don't know a solution to your problem but I'm looking for the same answer you're seeking. However, can you tell me how you were able to setup you're pdf's to work through HTTP POST. Any help will be appreciated.
Anyway, to get the pdf to output the form data to HTTP POST, you have to use an HTTP submit button in LiveCycle. You then have to set it to submit to a site that you create that will process the POST information. For my purposes, I created a submit.php file that took the POST info and inserted it into a mySQL database.
If you need details on how to get the HTTP POST fields to work, let me know and I'll explain better.
Any information you provide is helpful. I took a look at that example and it's cool. I was hoping that it would look similar to the form that the user would fill out and then be able to submit to a database and then print out the exact form. Having a lookup or search feature through the web would be ideal.
For now this is the best option. Thank you very much!
Is there anyway the PHP entries can look similar to the form? I didn't like that whole just straight down look and the field names are complexed. Employees may get confused looking at a complexed table on the web.
I wish there was a way to publish the already designed form to the web and have it submit to a SQL server, MySQL or even Access. This actually wasn't that hard to do with Microsoft's Infopath but I hated their controls.
The example I gave is completely barebones and purposely ugly. I haven't finished styling and designing it all yet--it was all done in a complex table so I could see all the data that was getting submitted. In the real version, the table is simpler and sortable and customizable and will be a lot less confusing.
It's purpose was to show one way to implement it, using arbitrary form field names. It's totally customizable.
Unfortunately, for the fdftk to work correctly, you have to use the long and complex field names because of how Designer structures the PDFs. If you used Acrobat to make the form fields, I believe the form names could be simpler, but I'm not sure.
The fdftk's only purpose for this application is the recreation of the PDF from submitted data. This example takes information submitted from an already designed form on the web and inserts it into a MySQL database--the only purpose of the table in my example was to show that the data actually gets in the server and can be reused for other things, like fdftk.
So, this should work for taking data and submitting it to a database.
I spent a good bit of time following your tutorial, I used LiveCycle Designer 8.0
everything went fine.. until the end, when i went to retrieve the PDF by clicking the link in viewpdf.php... and i cannot open the pdf, bc i get a warning that it is an unsupported format, corrupted or didnt decode properly, and when i open the PDF in Notepad its completely blank..
ive spent a couple days on this so far, and would love a little direction, b/c i believe there is just one thing missing.
Oops. Thanks for pointing out the fdftk typo - it really is pdftk - and the dead link. It actually wasn't dead...it was linking to my .htaccess file...that's kind of dangerous! It's all fixed now...
As for the blank and corrupted PDF file at the end...I haven't run across that. I have no idea what could be going wrong. So, I zipped up and uploaded a working copy of it. You just need to make a MySQL database and change the information in config_users.php to get it to work for you.
Hopefully the full code will better explain what's going on and will show us what's wrong in my tutorial. If anyone finds where I messed up, let me know and I'll change the tutorial
your link isnt working correctly, simply clicking it takes me to an un-styled xml file and d-loading it gives me nothing..
yes, that would be great to see the whoel working package and all the files invloved.. to where i could just put them on my server create the MySQL Database and see it working on my site then i know i can alter what i need to to conform for my use.
thank you for your time it is appreciated.
my email is firstname.lastname@example.org if you decide to email it to me..
I know this topic is old, but I am having trouble getting past inserting my data into the mySQL database from the PDF form. I have used your scripts and modified them with my information. I get "Successful" when I submit to the insert file, but nothing goes into the database. I even tried to use echo to set what's in the variable, and they are all blank. Any ideas why? I can send you my scripts if you would like.
I have a vital form that clients fill out, which is passed to many people in the company along the workflow. The form is a Planner and we have in the following PDF, Word Doc..
Well before, the Planner.pdf was originally created in Word, since most people have access to Word.. but evolved to a PDF form created from the Word Doc via Adobe LiveCycle Designer 8.0 w/ User Rights enabled so that the form could be filled out and saved using Adobe Reader.. which was a step better than Word.. being that it is free. But this needed to be easier and more to the point b/c some clients don't particularly like installing the latest version of Reader, even if you provide them the link. Nor do they like saving the form, filling the form, and attaching the form to send back.
My goal is to have the client fill an HTML version of the form, submit and be done with it, but everyone in the workflow be able to easily receive the filled Planner as a PDF form.
So some months ago I ran into this post Chris Trip, "Populate Livecycle PDF from mySQL database using PHP" #8, 22 Sep 2007 4:37 pm
which uses the command line Win32 pdftk.exe to merge an FDF file into an existing PDF on the remote server, and serve this to whoever.
My problem was with shared hosting and having the ability to use the Win32 pdftk.exe along with PHP which is predominantly used on Linux boxes. And we used a Linux box.
so i created the following unorthodox method, which a client fills the HTML version of the Planner, all field values are INSERTED into a table in MySQL DB, I and all filled planners that have been filled by clients to date can be viewed from a repository page where an XML file is served up of the corresponding client, but someone would have to have Acrobat Professional, to import the form data from the XML file into a blank form.. altoughh this is simple for me.. I have the PHP file already created so that when a Planner is filled and client submits. >> the an email is sent to me with a table row from the repository of the client name, #, email, and a link to d-load the XML file,
But I also have the PHP files created so that the Planner can be sent to by email to various people in the workflow with certain fileds ommitted they they do not need to see, but instead of the XML file beiong served up i need the filled PDF Planner to be served.
I can do this locally with ease on a testing server, but I am currently trying to use another host that uses cross-platform compatibility so i can use PHP and the pdftk.exe to achieve this, as that is why I am having to serve up an XML file b/c we use a Linux server for our website, and cant execute the exe.
Now that I am testing the other server (cross-platform host), just to use them to do the PDF handling (and it's only $5 per month) I am having problems with getting READ, WRITE, EXECUTE permissions..
Si guess a good question to ask is can PHP do the same procedure as the pdftk.exe, and i can eleminate it.
or how in the heck can i get this data from the DB into a blank PDF form, like i have described??
I recently found Andrew Heiss's Tutorial on PDF form to MySQL Database. I have Acrobat 8.0 w/ Livecycle, MySQL, & the insert.php file setup. I am not having any trouble getting data from the form to the database... except that when the data comes from the .pdf form it takes all the fields and puts the data from those fields into the first column only "FirstName" of the database. I think that the data is being combined on the form before being sent to the .php file because when I put a value into the variables on the .php page it organizes everything right.
Anyone have an idea why the fields combine together when being submitted and how to keep that from happening?
@bpittam - It can e-mail the PDF if you want, although the idea of the system is to reduce the amount of large files that need to be moved around, hence the MySQL database. You would just need to modify the code to use the PHP mail() function.