Page 1 of 1

Design Question

Posted: Sat Feb 23, 2008 6:23 pm
by Pyrite
I need to figure out a way for my company to give out a template to it's employees, be it by Word Document or PDF or something like that, where the boxes and text are in there, and they just have to fill in the blanks. And then go online and submit it to our site, so that php can parse it and put it in mysql, all broken down and tucked away.

Anybody ever done this? Any ideas on how? Not much luck getting php to parse word docs. PDF would be great, not everyone has pdf creation software. May be could use RTF or something. The employees just need to be able to have the document emailed to them, fill it out (offline, on the airplane, etc) and then send it back to us, and we'll have some way of mass importing each one into mysql.

Could really use some insight into how to do this.

Re: Design Question

Posted: Sat Feb 23, 2008 7:26 pm
by Christopher
You can have PDF forms that can be filled in. Why not just have a web form? Or maybe use some of the offline stuff like Google Gears or Mozilla's offline API?

Re: Design Question

Posted: Sun Feb 24, 2008 1:51 pm
by califdon
Although I haven't done precisely that, I have done just a little Microsoft Office Automation, and I believe that you could use VBA in either Access or Word to extract bookmarked data from a Word document and insert it into an Access table. Perhaps you could do that at the home office, from the submitted Word documents, then make a single transfer from Access to MySQL. What I have done is the reverse, using VBA in Access to insert data from a table into bookmarks in Word documents. VBA has a document object model that allows you to access parts of a document.

Re: Design Question

Posted: Mon Feb 25, 2008 8:11 am
by Pyrite
arborint wrote:You can have PDF forms that can be filled in. Why not just have a web form? Or maybe use some of the offline stuff like Google Gears or Mozilla's offline API?
I know you can have PDF's that can be filled in and printed. But are you sure you can have them that can be filled in and saved???

Webforms are not an option.

Re: Design Question

Posted: Mon Feb 25, 2008 8:24 am
by JayBird
Pyrite wrote:
arborint wrote:You can have PDF forms that can be filled in. Why not just have a web form? Or maybe use some of the offline stuff like Google Gears or Mozilla's offline API?
I know you can have PDF's that can be filled in and printed. But are you sure you can have them that can be filled in and saved???

Webforms are not an option.

You can, but the client needs to have the full Adobe Acrobat application. The reader can't do it.

Re: Design Question

Posted: Mon Feb 25, 2008 9:43 am
by Ollie Saunders
but the client needs to have the full Adobe Acrobat application. The reader can't do it.
To create the form you mean. Not to fill it in. I've filled in PDF forms with FoxIt Reader.

You might want to consider XUL (pronounced zool). You can easily create text fields in fact if you know HTML/CSS/JavaScript you should be right at home.

Re: Design Question

Posted: Mon Feb 25, 2008 10:00 am
by pickle
There is a way to set up a PDF so the reader itself POSTs the data. I've never done it myself, but I'm pretty sure I saw it in the preferences somewhere.

Re: Design Question

Posted: Tue Feb 26, 2008 3:03 am
by JayBird
ole wrote:
but the client needs to have the full Adobe Acrobat application. The reader can't do it.
To create the form you mean. Not to fill it in. I've filled in PDF forms with FoxIt Reader.

You might want to consider XUL (pronounced zool). You can easily create text fields in fact if you know HTML/CSS/JavaScript you should be right at home.

Yeah, its posts the data, but you cant save a copy of the form with the data entered into it

Re: Design Question

Posted: Tue Feb 26, 2008 8:09 am
by Ollie Saunders
You can with Foxit Reader. I have a file with saved stuff.

Re: Design Question

Posted: Thu Feb 28, 2008 10:20 pm
by Pyrite
Awesome!, so the real question is, can PHP parse the PDF?

I've seen many classes to create them, not many to read/parse them though?

Re: Design Question

Posted: Thu Feb 28, 2008 10:46 pm
by alex.barylski
Pyrite wrote:Awesome!, so the real question is, can PHP parse the PDF?

I've seen many classes to create them, not many to read/parse them though?
Sure. Do people typically bother? No.

PDF is a native plain-text format I believe. However most applications these days encrypt and/or compress the PDF making it not-so-easy on the naked eye(s).

Of course you could reverse what has been done, but that is a tremendous amount of work.

Most people just create a rough template of what they want, and use placeholders to indicate where in the PDF they want data injected, etc. Likewise, libraries like http://www.pdflib.com/products/pdflib-family/ go a littler further and let you dynamically compose a PDF from several "blocks" I think they are refered to as.

HTH

Re: Design Question

Posted: Fri Feb 29, 2008 1:18 am
by Kieran Huggins
pickle wrote:There is a way to set up a PDF so the reader itself POSTs the data. I've never done it myself, but I'm pretty sure I saw it in the preferences somewhere.
I've built many such PDFs, and they behave just like a webform. They'll POST to any URL you ask them to. You don't need to safe and send the PDF anywhere, just fill it in and hit "submit" like a web form.

PHP handles the data just like any other form submission. There's no special parsing involved. None. Really.

Incidentally, you can save form data in Adobe Reader (the free viewer) as well as Acrobat (the expensive viewer/writer), provided they're not locked to specifically forbid it. I actually like PDFs, kinda. OK, maybe "like" is a tad strong, but they have a few good uses.