将word转化为swf 如同百度文库般阅读实现思路及代码
<div class="codetitle"><a style="CURSOR: pointer" data="77338" class="copybut" id="copybut77338" onclick="doCopy('code77338')"> 代码如下:<div class="codebody" id="code77338"> <IMG src="https://files.52php.cn/file_images/article/201308/201308091717039.gif?201379171718"> <IMG src="https://files.52php.cn/file_images/article/201308/2013080917173610.gif?201379171749"> <div class="codetitle"><a style="CURSOR: pointer" data="69052" class="copybut" id="copybut69052" onclick="doCopy('code69052')"> 代码如下:<div class="codebody" id="code69052"> <PRE class=php name="code"><?php class RunTime//页面执行时间类 { private $starttime;//页面开始执行时间 private $stoptime;//页面结束执行时间 private $spendtime;//页面执行花费时间 function getmicrotime()//获取返回当前微秒数的浮点数 { list($usec,$sec)=explode(" ",microtime()); return ((float)$usec + (float)$sec); } function start()//页面开始执行函数,返回开始页面执行的时间 { $this->starttime=$this->getmicrotime(); } function end()//显示页面执行的时间 { $this->stoptime=$this->getmicrotime(); $this->spendtime=$this->stoptime-$this->starttime; //return round($this->spendtime,10); } function display() { //$this->end(); echo " 运行时间:".round($this->spendtime,10)."秒 ";} } /调用方法 / $timer=new Runtime(); $timer->start(); 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.frame.Desktop"); $oWriterDoc = $oDesktop->loadComponentFromURL ($doc_url,"_blank",$args); $export_args = array(MakePropertyValue ("FilterName","writer_pdf_Export",$osm)); $oWriterDoc->storeToURL($output_url,$export_args); $oWriterDoc->close(true); } $output_dir = "C:/"; $doc_file = "C:/t.doc"; $pdf_file = "9.pdf"; $output_file = $output_dir . $pdf_file; $doc_file = "file:///" . $doc_file; $output_file = "file:///" . $output_file; word2pdf($doc_file,$output_file); $timer->end(); $timer->display(); ?>
花费时间进行分析: 将一个大小为1.48M的word文档转化为pdf需要<SPAN style="FONT-FAMILY: Simsun; FONT-SIZE: 14px">运行时间:1.3652579784秒 自己电脑是这个时间,自己测试
其次将pdf转化为swf,需要运用另外一个软件,swftools 通过代码调用cmd命令,直接上代码 <PRE class=php name="code"><?php } } /调用方法 / $timer=new Runtime(); $timer->start(); //调用系统软件 $command = ""C:Program FilesSWFToolspdf2swf.exe" -t C:8.pdf -s flashversion=9 -o C:m.swf"; echo $command; exec($command); echo 'ok'; $timer->end(); $timer->display(); ?> 将刚才转化而来的pdf转化为swf文件需要用<SPAN style="FONT-FAMILY: Simsun; FONT-SIZE: 14px">运行时间:1.3119211197秒时间 <SPAN style="FONT-FAMILY: Simsun; FONT-SIZE: 14px">最后则是将swf文件显示在网页中,这一步需要引入多个js文件和其他文件,代码就不写了,直接下载,在我的上传资料中
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |