Solved

Export .doc to .pdf in php

Posted on 2008-06-13
4
3,797 Views
Last Modified: 2008-11-21
I want to create .pdf files from .doc. I would like to use any php library for it and I would like to avoid any command-line solution.
0
Comment
Question by:SWB-Consulting
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 24

Accepted Solution

by:
purplepomegranite earned 250 total points
ID: 21783614
Funnily enough I have a requirement to do exactly the same thing.

However, I don't believe it is possible to achieve this directly from PHP.  Or rather, that anyone has implemented it - most document conversion to pdf is based on printer gdis, which means the converter doesn't actually have to understand the source file, just the printer data.  To convert .doc to .pdf solely using PHP you'd need to be able to read the Word document using PHP, and then output it (which is the easy bit).  It would be a huge task I think to write a PHP library that could decipher a Word document appropriately.

It would be easily possible via command-line.  Many utilities convert to pdf, as I'm sure you know.  The only issue there is having access to command-line tools on the server.  On my test server (which is mine), I do... on my production server (hosted), I don't... so I also can't implement a command-line solution.  Unfortunately I have had to use a workaround for the requirement due to lack of being able to find any native way of converting Word docs... I have required the user to convert his own documents using CutePDF.
0
 
LVL 3

Assisted Solution

by:Xorlev
Xorlev earned 250 total points
ID: 21783811
You can't convert .doc with pure PHP, but what I've done is used abiword (via command line) to convert documents to HTML. You can also have it convert to PDF, but for my use it was HTML.

If you want a pure PHP PDF solution, it's been done. It converts HTML -> PDF.
http://www.digitaljunkies.ca/dompdf/
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question