php利用openoffice把doc转换为PDF, txt or HTML

参考文档:http://www.lampdeveloper.co.uk/linux/converting-doc-to-pdf-txt-or-html-using-php-and-linux.html

主要是利用openoffice文档转换服务

This basically creates the following deamon

soffice.bin -nologo -nodefault -accept=socket,host=localhost,port=2002;urp;StarOffice.ComponentContext

You can now send requests to port 2002 using unoconv

/usr/bin/unoconv --server localhost --port 2002 --stdout -f pdf input.doc

<?php

$args = '/usr/bin/unoconv --server localhost --port 2002 --stdout -f pdf ' . 目标文件地址 ; 

$pdf = shell_exec ( $run );  


?>

猜你喜欢

转载自yi5414289.iteye.com/blog/1714113