php 在线浏览word paf

来源:互联网 发布:我看网络用语走红 编辑:程序博客网 时间:2024/06/06 14:24

其他格式-> Openoffice -> pdf格式
pdf格式 -> Swftool -> swf 格式
Flexpaper -> 加载 swf格式显示在线阅读

//word转pdffunction MakePropertyValue($name,$value,$osm){    $oStruct=$osm->Bridge_GetStruct("com.sun.star.beans.PropertyValue");    $oStruct->Name = $name;return $oStruct;}function word2pdf($doc_url, $output_url){    $osm = new COM("com.sun.star.ServiceManager")or die ("请确认OpenOffice.org库是否已经安装.\n");    $args = array(MakePropertyValue("Hidden",true,$osm));    $oDesktop = $osm->createInstance("com.sun.star.frame.Desktop");    $oWriterDoc = $oDesktop->loadComponentFromURL($doc_url,"_blank", 0, $args);    $export_args = array(MakePropertyValue("FilterName","writer_pdf_Export",$osm));    $oWriterDoc->storeToURL($output_url,$export_args);    $oWriterDoc->close(true);}//路径注意事项必须使用 '/' $output_dir = "D:/temp/";$doc_file = "D:/temp/test.doc";$pdf_file = "tests.pdf";$output_file = $output_dir.$pdf_file;$doc_file = "file:///".$doc_file;$output_file = "file:///".$output_file;word2pdf($doc_file,$output_file);//pdf文档转换swf    public function pdf2swf($sourcePath,$targetPath){        header("Content-type: text/html; charset=utf-8");        $pdf2swf='D:/SWFTools/pdf2swf.exe';  //pdf格式转换swf格式的程序所在目录        $argStr=$pdf2swf." -t ".$sourcePath." -s flashversion=9 ".$targetPath;        exec($argStr,$out,$status);  //cmd执行命令    }}

然后用Flexpaper显示swf文件,后续步骤请百度,未进行金一步操作。

0 0