Export PDF document according to input from form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mglinx
Forum Newbie
Posts: 1
Joined: Sat Aug 08, 2009 5:45 am

Export PDF document according to input from form

Post by mglinx »

Hi all,

I'll try and keep this brief.


Short version:
After the user has input information into the form. I want them to be able to click a button such as 'Finish' and a PDF will be generated.

The form will simply have 12 drop down boxes, allowing them to select up to 12 options in whatever order they choose.
Each option will have about a paragraph of text and 3 small images allocated to it, for when the PDF is generated.
Additionally, if more than 4 options are chosen then it needs to know to put only 4 to a page, and put the next 4 on the next page.

I would like this to export and print to a letterhead that I already have set up in both PDF and DOC formats.

A name and date will also be input in the form page and I would like that exported at the top.


I assume I will need to use a MySQL database to store the 12 options and their relative info and images. I will also be setting up a login system so that the info can be changed/updated in the future.


Any ideas of how I would go about this would be greatly appreciated.
Many thanks,
Mike
User avatar
jazz090
Forum Contributor
Posts: 176
Joined: Sun Apr 12, 2009 3:29 pm
Location: England

Re: Export PDF document according to input from form

Post by jazz090 »

you make it sound so simple as i thought when approaching something similar to this.bottom line you cant get a good result unless you want to spend a bit of money
there are some tools out there that create PDF from scratch like TCPDF but lack some very important features. your best bet will be openoffice which needs to run on a minimum VPS server. or if you are just curious you can install it on your own testing server as well. as far as PHP goes, PDF is really a under-looked issue and lack some very important features.

as for word documents, i'm afraid Microsoft has tied our hands again with it unorthodox .docx and .doc files so you are going to have to use .rtf instead. in word create a file and place some markers such as <<NAME>> and <<DATE>> and save as RTF. then fread() the file as binary in php and simple do a str_replace with these markers and echo the binary with application/ms-word mime type for intimidate display or save with fwrite or put_contents()
Post Reply