自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

PHP處理Word轉(zhuǎn)PDF技巧講解

開發(fā) 后端
PHP處理Word轉(zhuǎn)PDF對(duì)于初學(xué)者來說還是一個(gè)比較難掌握的問題。本文我們介紹了這一功能的實(shí)現(xiàn)方法,希望對(duì)大家有所幫助。

我們知道,PHP語(yǔ)言的合理運(yùn)用可以幫助我們實(shí)現(xiàn)導(dǎo)出Word文檔的功能。今天我們將為大家介紹PHP處理Word轉(zhuǎn)PDF的相關(guān)實(shí)現(xiàn)方法。#t#

PHP處理Word轉(zhuǎn)PDF代碼示例:

  1. < ?php  
  2. set_time_limit(0);  
  3. function MakePropertyValue($name,$value,$osm){  
  4. $oStruct = $osm->Bridge_GetStruct
    ("com.sun.star.beans.PropertyValue");  
  5. $oStruct->Name = $name;  
  6. $oStruct->Value = $value;  
  7. return $oStruct;  
  8. }  
  9. function word2pdf($doc_url, $output_url){  
  10. $osm = new COM("com.sun.star.ServiceManager") 
    or die ("Please be sure that OpenOffice.org 
    is installed.\n");  
  11. $args = array(MakePropertyValue("Hidden",true,$osm));  
  12. $oDesktop = $osm->createInstance("com.sun.star
    .frame.Desktop");  
  13. $oWriterDoc = $oDesktop->loadComponentFromURL
    ($doc_url,"_blank", 0, $args);  
  14. $export_args = array(MakePropertyValue
    ("FilterName","writer_pdf_Export",$osm));  
  15. $oWriterDoc->storeToURL($output_url,$export_args);  
  16. $oWriterDoc->close(true);  
  17. }  
  18. $output_dir = "D:/LightTPD/htdocs/";  
  19. $doc_file = "D:/LightTPD/htdocs/2.doc";  
  20. $pdf_file = "2.pdf";  
  21. $output_file = $output_dir . $pdf_file;  
  22. $doc_file = "file:///" . $doc_file;  
  23. $output_file = "file:///" . $output_file;  
  24. word2pdf($doc_file,$output_file);  
  25. ?> 

以上這段代碼就是PHP處理Word轉(zhuǎn)PDF的相關(guān)實(shí)現(xiàn)方法。

責(zé)任編輯:曹凱 來源: 百度博客
相關(guān)推薦

2009-12-11 17:57:13

PHP應(yīng)用JSON

2009-12-10 17:37:28

PHP Cookie登

2009-12-04 15:52:46

PHP導(dǎo)入Excel文

2009-12-09 16:53:45

PHP打印任意時(shí)間

2009-11-27 13:24:20

PHP代碼性能優(yōu)化

2009-12-09 13:32:08

PHP zend安裝

2009-11-27 16:20:22

PHP遞歸調(diào)用

2009-11-30 09:21:39

PHP函數(shù)rmdir(

2020-05-11 10:59:02

PythonWord工具

2009-12-01 19:17:48

PHP開發(fā)高效WEB系

2009-12-11 14:21:57

PHP獲取字段屬性

2009-11-30 15:10:46

PHP substr函

2009-12-11 14:11:03

PHP獲取字段數(shù)目

2010-02-23 10:57:34

WCF Streami

2024-09-24 10:16:13

PythonWord文檔

2023-12-18 08:24:09

LinuxPythonWord

2009-12-14 09:33:04

Ruby安裝

2010-09-14 17:20:57

2009-12-25 17:39:01

WPF驗(yàn)證

2010-01-25 10:46:29

Android Spi
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)