lyd2004888 发表于 2017-4-11 10:11:29

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 );

?>
页: [1]
查看完整版本: php利用openoffice把doc转换为PDF, txt or HTML