How to convert Doc to PDF

Here is some background information. I am using a shared Linux server with hostgator.

I watched

to no avail.

My server setup either doesn't support installation, or the program doesn't do what I need it to.

I want to use php programmatically

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

What are my options? Any suggestions...?


source to share

3 answers

Have you looked into OpenOffice in headless mode? A quick link was found here that might get you in the right direction.



You might want to consider upgrading to a VPS to install your own modules, or ask the host giant if they will install it for you.

The best I've seen so far is Pruno for using the OpenOffice API in php - although this will probably not be possible for a shared host.

Antiword converts the words docs to plaintext or postscript, which seems pretty nice - although you will need to figure out what type of document it is how you will have to process the document with a different method if it is docx ... although again this will probably not be possible on a shared hosting server.

Perhaps you should consider getting a more programmer-friendly host. I use ChicagoVPS (link is my affiliate link - not an affiliate link here ) as they have pretty decent performance (my previous line cells looked a little faster in terms of CPU tasks), often display on lowendbox and you can pretty much get 2GB openvz flash (from their chicago datacenter) for $ 7 / mo (promo code: 2048).

I had a drop in performance once within 2 days, but it was due to some hardware and maintenance issues, they notified me many times a day about the status and quickly fixed it so I was stuck with them.

If vps isn't for you, webfaction is a simple, programmer friendly hosting.



If using a web service is a viable option for your application, check out Docmosis Cloud Services. From the list of requirements:

  • load doc - yes
  • produce pdf - yes
  • watermark - yes
  • merging - yes - but you will need to provide a doc or odt version, not a pdf
  • save to db - your control (you will save streamed result to db)
  • email - yes

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



All Articles