代码如下:
<?php
set_time_limit(0);
function MakePropertyValue($name,$value,$osm){
$oStruct = $osm->Bridge_GetStruct(\"com.sun.star.beans.PropertyValue\");
$oStruct->Name = $name;
$oStruct->Value = $value;
return $oStruct;
}
function word2pdf($doc_url, $output_url){
$osm = new COM(\"com.sun.star.ServiceManager\") or die (\"Please be sure that OpenOffice.org is installed.\\n\");
$args = array(MakePropertyValue(\"Hidden\",true,$osm));
$oDesktop = $osm->createInstance(\"com.sun.star. .Desktop\");
$oWriterDoc = $oDesktop->loadComponentFromURL($doc_url,\"_blank\", 0, $args);
$export_args = array(MakePropertyValue(\"FilterName\",\"writer_pdf_Export\",$osm));
//print_r($export_args);
$oWriterDoc->storeToURL($output_url,$export_args);
$oWriterDoc->close(true);
}
$output_dir = \"C:/wamp/www/projectfolder/\";
$doc_file = \"C:/wamp/www/projectfolder/wordfile.docx\";
$pdf_file = \"outputfile_name.pdf\";
$output_file = $output_dir . $pdf_file;
$doc_file = \"file:///\" . $doc_file;
$output_file = \"file:///\" . $output_file;
word2pdf($doc_file,$output_file);
?> 继续阅读与本文标签相同的文章
上一篇 :
php mail()函数用方实例
下一篇 :
checkbox全选以及反选/取消全选
-
超进化,时尚玩主的全新一代名爵ZS,起步只要7.98万
2026-05-14栏目: 教程
-
微信 7.0.8 内测新功能,教你如何激活它
2026-05-14栏目: 教程
-
美女机器人刚上市就售罄,除了生孩子,其他什么都能干!
2026-05-14栏目: 教程
-
互联网之光大会的黑科技,总有一款惊艳你!
2026-05-14栏目: 教程
-
微信宣布一项新举措,关系到每一个用户,网友一致力挺:干得漂亮!
2026-05-14栏目: 教程
