Page 1 of 1

creating a .pdf from .doc

Posted: Fri Apr 14, 2006 8:15 am
by lc
Ok did a heap of searches everywhere (here also) and I couldn't find anything that really helped me.

The situation is the following... A customer wants to upload a .doc file and automaticly send it as a .pdf file as a mail attachment.

Now creating a .pdf isn't really the issue, nor is sending as an attachment.

The .doc to .pdf conversion is troubling though.

The only option I could find was using a COM class to open Open Office to do the conversion, but that's no option on this server... sadly.

Has anyone got any ideas or pointers??? I'd really appreciate the help! ;)

Posted: Fri Apr 14, 2006 8:44 am
by feyd
If you can't use OpenOffice, then you may need to use an online service or just have them upload PDF files. The latter is likely best due to them verifying the file is converted correctly (by use of a printer driver in Word itself.)

Posted: Sun Apr 16, 2006 6:55 am
by lc
Well yeah... that'd be nice... but if that was an option I would have just done that in stead of spending hours looking for another solution.

Posted: Sun Apr 16, 2006 9:08 am
by Ambush Commander
You mean you can't just tell your users to send you a nicer file format?

Posted: Sun Apr 16, 2006 9:22 am
by timvw
The "easiest" would be to install a pdf printer.. Then open the .doc with ms-word and print witht he pdf printer... Done ;)

Posted: Sun Apr 16, 2006 9:54 am
by lc
Nah I can't have the customer do too much in this case... as usual they're quite technologicly challenged and having them create their own pdf file is really no option.

Installing a pdf printer would be lovely... but of course that is not an option either.... no access to the server, no way to have them do it for me.

Naturally everything is becoming more simple by the minute.

I'm afraid I'll probably end up having them enter the text in chunks in textareas and then creating the pdf on the fly from that... which is no problem, but it would create issues with layout and the ammount of chunks would have to be variable.... all in all quite a headache for both user and me.... I'm just hoping someone has a better idea.

Posted: Sun Apr 16, 2006 12:04 pm
by Benjamin
All they have to do is..

1. Open the document
2. Click File
3. Click Print
4. Select the PDF printer
5. Save the File
6. Upload it

If they can't do that, and they are willing to pay for a "more advanced" solution then hey, more money for you.

Posted: Sun Apr 16, 2006 7:55 pm
by timvw
Even simpler, ask the ISP to install that driver.. If not, get one that does.

(Client is king.. Even when he's a programmer that needs to get a job done. When the hosting is provided by your clients, make them aware of the addiontal cost because their ISP doesn't cooperate.. In my experience they seem to have more influence on those ISPs ;))

Posted: Sun Apr 16, 2006 8:02 pm
by ntbd
Different idea... Try and play with Tiny MCE. This is a richtext editor script in Javascript, but it has an option to paste from word where it then converts all the formating to HTML, which you can then use to generate the PDF. Google Tiny MCE and look at their examples.

Posted: Sun Apr 16, 2006 9:28 pm
by Chris Corbyn
Just text or images too? If there's images in the documents (which come in various formats pre/post 95) then it's gonna be almost a no-goer. If its just text you might stand a chance... I think I've seen a class (not free) somewhere that can open MS Word documents without COM. I'll have another search.

Posted: Mon Apr 17, 2006 12:17 am
by timvw
These days word has a 'xml' format.. Documentation can be found on microsoft/msdn.. But you still have to have to translate the xml to pdf..

Posted: Mon Apr 17, 2006 1:24 am
by Christopher
You could have the clients save as RTF rather than DOC. As I recall RTF is pretty easy to parse and there are parsers available.

Posted: Mon Apr 17, 2006 9:56 am
by Ambush Commander
Most of the RTF parsers out there, however, are poorly written, and plus, with almost anything from Word (or anything WYSIWYG), you have to parse what they mean not what they wrote.

Posted: Mon Apr 17, 2006 1:18 pm
by lc
Well indeed... a word format would be an option, but not quite fool proof.

I think I can draw the conclusion that an online set of textareas combined with a table in the database is the way to go here.
I can't really see any other option that gives enough control. I've seen too many "customers" mess up o so simple tasks.