I thought I would be able to find a plugin for this but there’s doesn’t seem to be one.
This is the required process:
The user fills in a form on the site (preferably cforms!)
The data from the form populates the empty cells of a pdf on the sever
Then, well once I get that far then I’ll worry about the next steps!
Generating the pdf is not an option as it’s a legal document.
Thanks.
Ok, I’ve worked out how to do this, it seems to be a bit messy, shame there is not a simpler way!
The two plug-ins I’m using are cforms (www.deliciousdays.com/cforms-plugin) and a plug-in which loads the Zend framework (h6e.net/wordpress/plugins/zend-framework) this is needed for it’s pdf writing abilities.
With both plug-ins activated locate the file in the cforms plug-in directory called my-functions.php and download to your computer. Most of this file is commented out so you need to uncomment the function
Anything in this function will run when the submit button is pressed (see the cforms API documentation for more details). You can test this is working but echoing something in the this function. You can also test the Zend framework has been loaded using
The form fields come in an array so we need to print that out first to work out the names of the fields (replacing “5” with whichever form you are using):
Once you have your field names this is the full code to write to the pdf
I had problems to start with as the pdf I was using wasn’t the right type, you can check that your code is correct by creating a pdf using Zend pdf as that should always work (find out how to do that here: framework.zend.com/manual/1.12/en/zend.pdf.html).
I use Photoshop to work out the exact locations I want to write at by setting the ruler to ‘points’