3

Here is some background info. I'm on a shared linux server with hostgator.

I've looked at

to no avail.

My server setup either does not support the setup or the program does not do what I need.

I want to programmatically using php

  • allow my users to upload .doc files,
  • convert them to .pdf files,
  • add either a background/watermark/stamp with my company logo/link to website on each page of the converted .pdf file,
  • merge the converted .pdf file to an existing promotion .pdf file,
  • save and store the completed file to the server/database using the original file name of the .doc file,
  • and then email the file to my mailing list.

What are my options? Any suggestions...?

Toby Allen
  • 10,997
  • 11
  • 73
  • 124
Spartacus
  • 31
  • 1
  • 2
  • 2
    Suggestion a) would be to use a Windows server running Word. It's the Word->PDF bit you'll struggle with on a linux box. – Orbling Mar 22 '12 at 16:40
  • 1
    Conversion of `.doc` to `.pdf` appears to be possible via the OpenOffice API http://www.webdeveloper.com/forum/showthread.php?t=128143 – ChrisW Mar 22 '12 at 16:57

3 Answers3

1

Have you looked into running OpenOffice in Headless mode? Here's a quick link I found that may get you in the right direction.

http://qugstart.com/blog/linux/openoffice-headless-mode-installation-word-doc-to-pdf-conversion/

Jako
  • 4,731
  • 7
  • 39
  • 54
1

You may want to consider moving to a VPS in order to install your own modules, or ask hostgator if they'll install one for you.

The best I've seen so far is Pruno for using the OpenOffice API in php - though this will likely be impossible on a shared hostgator server.

Antiword converts word docs to plaintext or postscript, which seems pretty nice - though you'll have to detect which type of document it is as you'll have to process the doc using a different method if it's a docx...though once again, this will likely be impossible on a shared hostgator server.

You may want to consider getting a more programmer friendly host. I use ChicagoVPS (the link is my affiliate link - here's a non-affiliate link) as they have pretty decent performance (my past linode boxes did seem a bit faster regarding CPU tasks), are often featured on lowendbox and you can pretty much always get a 2GB of ram openvz box (from their chicago datacenter) for $7/mo (promo code: 2048).

I had my performance dip once for 2 days, but it was due to some hardware issues and maintenance, they notified me many times a day on the status, and promptly had it fixed so I've stuck with them.

If a vps is not for you, there's webfaction - an awesomely programmer friendly 'shared' host.

AndrewPK
  • 6,100
  • 3
  • 32
  • 36
0

If using a web-service is a viable option for your application have a look at Docmosis Cloud services. From your requirement list:

  1. upload doc - yes
  2. produce pdf - yes
  3. watermark - yes
  4. merging - yes - but you'd have to provide a doc or odt version rather than pdf
  5. store in db - your control (you would save the streamed result to the db)
  6. email - yes

Access from PHP is pretty straight forward since you can just HTTPS post a request. Please note I work for the company that develops Docmosis.

Paul Jowett
  • 6,513
  • 2
  • 24
  • 19