Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Convert Word (DOC), Excel (XLS) files to PDF using PHP.

Posted on 2006-11-13
7
Medium Priority
?
5,970 Views
Last Modified: 2010-05-18
Hi,

I'm looking for a reliable solution for converting Word and Excel files to PDF using only PHP (if one exists). The only way I can think of doing it, is to have a non-shared web server where we are allowed to install postscript printer drivers etc. to output postscript for the conversion to PDF. Is there a good way to do it on any old shared web server where we have no control over what has been installed on the server?

Please point me in the right direction, if anyone knows of anything which may work.
0
Comment
Question by:theblip
[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
7 Comments
 
LVL 48

Expert Comment

by:hernst42
ID: 17928556
AFAIk there is no such a solutions. There are tools to get text/data from those formats, but there is no php-only code which could print those data as found in those files.
0
 
LVL 11

Accepted Solution

by:
neester earned 500 total points
ID: 17928568
the only thing i can suggest would be by using a DOC or XLS reader, then using a module like this:

http://www.ros.co.nz/pdf/


there is a working example of printing a PDF from text input...
so I assume from a file input should be just as easy - just a bit more effort and time required.
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 17928572
Hi,

There are php classes to write pdf files - there are also drivers to read word and excel files.

You would be able to read the data - then convert it and pass it to a class to create the pdf.  This is not going to be precise - it will be slow and may have very different formatting.

As hernst42 suggested you could not print the data exactly as found.

If I were you I would not rely on postcript drivers - I would either build an ASP.NET web service to dynamically convert these files and return the output (there are classes to do this with c#)

Depending on your requirements you may be best storing your documents in a database - having another program run over the data saved, convert them and then save them back to the database converted (but this may be best done in a batch job rather than being instaneous)
0
 
LVL 35

Assisted Solution

by:Raynard7
Raynard7 earned 500 total points
ID: 17928573
I use the classes that neester suggested - they are very good - but as mentioned you would be able to get the data into pdf however it would not appear as it does in word or excel
0
 
LVL 3

Expert Comment

by:jmar_click
ID: 17931918
http://us3.php.net/pdf

Maybe that will help
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

636 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