久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      怎么實現(xiàn)php在線演示功能

      php在線演示功能的實現(xiàn)方法:1、將其他格式的文檔通過OpenOffice轉(zhuǎn)換成PDF格式文檔;2、通過swftools將PDF格式文檔轉(zhuǎn)換為swf格式文檔;3、通過flexpaper顯示swf格式的文檔,從而實現(xiàn)預覽多種格式的文檔即可。

      怎么實現(xiàn)php在線演示功能

      本文操作環(huán)境:Windows7系統(tǒng)、PHP7.1版,DELL G3電腦

      怎么實現(xiàn)php在線演示功能?

      Windows下實現(xiàn)php在線預覽功能

      最近用到文檔在線預覽功能,之前沒接觸過,一切從零開始,整了一段時間終于實現(xiàn),現(xiàn)在把方法分享給大家!

      一、主要思路

        先將其他格式的文檔(office文檔、txt、圖片等等)通過OpenOffice轉(zhuǎn)換成PDF格式文檔,然后通過swftools(http://www.swftools.org/)將PDF格式文檔轉(zhuǎn)換為swf格式文檔,最后通過flexpaper顯示swf格式的文檔,從而實現(xiàn)預覽多種格式的文檔。

        使用到的工具自己從網(wǎng)上下載,很好找的。

      二、實現(xiàn)過程

        1.其他文檔轉(zhuǎn)為PDF

         用命令啟動OpenOffice:

            運行->cmd,輸入下面的命令

      cd /d E:/openoffice/program & soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard

            或者在cmd中進入program目錄,然后輸入

      soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard

         php實現(xiàn)代碼:     

       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.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);                          }                         $doc_file = 'D:/wamp/www/onlineread/uploads/docfile.doc';                          $output_file = 'D:/wamp/www/onlineread/uploads/pdffile.pdf';                         $doc_file = "file:///" . $doc_file;                          $output_file = "file:///" . $output_file;                        word2pdf($doc_file,$output_file);

        2.PDF轉(zhuǎn)換為swf并顯示

         php實現(xiàn)代碼:

      <div style="width:100%;height:800px;display:block;margin-left: auto;margin-right: auto; margin-top: 20px;">          <a id="viewerPlaceHolder" style="width:100%;height:800px;display:block;"></a>            <script type="text/javascript">            var path="/<?=$convert?>";//調(diào)用php的變量,如果不能實現(xiàn)可考慮下一句的寫法            //var path="/<?php echo $convert?>";              var fp = new FlexPaperViewer(              '__PUBLIC__/FlexPaper/FlexPaperFlash/FlexPaperViewer',              'viewerPlaceHolder', { config : {//配置參數(shù),可自行修改成自己想要的                SwfFile : escape(path),                Scale : 1,                ZoomTransition : 'easeOut',                ZoomTime : 0.5,                ZoomInterval : 0.2,                FitPageOnLoad : false,                FitWidthOnLoad : false,                PrintEnabled : true,                FullScreenAsMaxWindow : false,                ProgressiveLoading : false,                MinZoomSize : 0.2,                MaxZoomSize : 5,                SearchMatchAll : false,                InitViewMode : 'Portrait',                ViewModeToolsVisible : true,                ZoomToolsVisible : true,                NavToolsVisible : true,                CursorToolsVisible : true,                SearchToolsVisible : true,                localeChain: 'en_US'            }});          </script>        </div>

        3.運行前的準備

         需要先進行如下的設置,否則運行過程中可能會出錯!

         控制面板-管理工具-組件服務-計算機-我的電腦-DOCM配置,找到OpenOffice Service Manager(Ver 1.0)右鍵屬性,按下圖所示進行配置:

                      如下圖所示找到OpenOffice Service Manager(Ver 1.0):

      怎么實現(xiàn)php在線演示功能

                        在彈出框中選擇‘安全’,分別編輯‘啟動和激活權(quán)限’和‘訪問權(quán)限’:

      怎么實現(xiàn)php在線演示功能

                         在‘啟動和激活權(quán)限’彈出框中點擊添加,輸入Everyone:

      怎么實現(xiàn)php在線演示功能

                        設置Everyone的權(quán)限:

      怎么實現(xiàn)php在線演示功能

                        在‘訪問權(quán)限’的彈出框中點擊添加,輸入Everyone:

                      怎么實現(xiàn)php在線演示功能

                       設置Everyone權(quán)限:

      怎么實現(xiàn)php在線演示功能

                        在屬性對話框中選擇‘標識’,選擇‘交互式用戶’:

        怎么實現(xiàn)php在線演示功能

         如果遇到COM類實例化失敗的問題,打開php配置文件,去掉com.allow_dcom=true前面的分號,并添加extension=php_com_dotnet.dll,因為php5.4以后就不內(nèi)嵌com了。

         設置好后不要忘記重啟服務哦!

         推薦學習:《PHP視頻教程》

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號