views:

149

answers:

6

Hi,

Is there any way to convert rtf format to pdf using PHP?

Thanks

+1  A: 

You can use OpenOffice command line interface for that. Check my answer to a similar question.

Ivan Krechetov
+1  A: 

If you want to stick with pure PHP, you can probably use HTML as an intermediary:

  1. Convert RTF to HTML
    http://freshmeat.net/projects/rtf2htm/ , http://phpclasses.chimit.nl/browse/package/1930.html
  2. Optionally: clean up the HTML
    http://htmlpurifier.org/
  3. Convert HTML to PDF
    http://www.digitaljunkies.ca/dompdf/about.php
Joeri Sebrechts
A: 

You can use Aspose.Words for .NET and invoke it from PHP using the COM Bridge as described in this article.

Your code will look something like this:

//Create instance of ComHelper class
$helper = new COM("Aspose.Words.ComHelper");

//Open a template document
$doc = $helper->Open("C:\\Temp\\in.rtf");  // NOTE It can also be DOC, DOCX, ODT, HTML 

$doc->Save("C:\\Temp\\out.pdf");  // NOTE It can be any of the Aspose.Words supported output formats.
romeok
A: 

Ted is the tool you're looking for. Ted brings also a script called rtf2pdf.sh you can execute by PHP to create a PDF file.

DrDol
A: 

you can try simpo pdf creator which can works as a virtul printer, just open your file go to print,then it will be converted into pdf format.http://www.simpopdf.com/pdf-creator.html

kethy
A: 

You should try out livedocx livedocx.com . The latest Zend Framework 1.10 has a ready built module to help you out. You can read more about it at this place http://www.phpfreaks.com/tutorial/template-based-document-generation-using-livedocx-and-zend-framework

WebGuru