Solved

Export .doc to .pdf in php

Posted on 2008-06-13
4
3,800 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

739 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