搜尋
首頁後端開發php教程利用openoffice把office转成pdf,组件无法使用,请诸位大侠帮忙

利用openoffice把office转成pdf,组件无法使用,请各位大侠帮忙。

本帖最后由 nationzhou 于 2013-05-18 16:42:24 编辑 php 利用openoffice把office转成pdf格式 问题请教
代码如下:

function MakePropertyValue($name,$value,$osm){  <br />	$oStruct = $osm->Bridge_GetStruct("com.sun.star.beans.PropertyValue");  <br />	$oStruct->Name = $name;  <br />	$oStruct->Value = $value;  <br />	return $oStruct;  <br />}<br /><br />function word2pdf($doc_url, $output_url){  <br />	$osm = new COM("com.sun.star.ServiceManager") or die ("Please be sure that OpenOffice.org is installed.n");  <br />	$args = array(MakePropertyValue("Hidden",true,$osm));  <br />	$oDesktop = $osm->createInstance("com.sun.star.frame.Desktop");  <br />	$oWriterDoc = $oDesktop->loadComponentFromURL<br />	($doc_url,"_blank", 0, $args);  <br />	$export_args = array(MakePropertyValue<br />	("FilterName","writer_pdf_Export",$osm));  <br />	$oWriterDoc->storeToURL($output_url,$export_args);  <br />	$oWriterDoc->close(true);  <br />}<br /><br />$output_dir = "D:/APMServ5.2.6/www/htdocs/pdf/";  <br />$doc_file = "D:/APMServ5.2.6/www/htdocs/doc/abc.doc";  <br />$pdf_file = "abc.pdf";  <br />$output_file = $output_dir . $pdf_file;  <br />$doc_file = "file:///" . $doc_file;  <br />$output_file = "file:///" . $output_file;<br /><br />word2pdf($doc_file,$output_file);
 


错误提示:
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `com.sun.star.ServiceManager': 服务器运行失败 ' in D:\APMServ5.2.6\www\htdocs\phpinfo.php:13 Stack trace: #0 D:\APMServ5.2.6\www\htdocs\phpinfo.php(13): com->com('com.sun.star.Se...')

系统环境:apache, php5.2.6, php.ini已开启com,dcom ,
操作系统:win2003,  已安装过OpenOffice3.2, 已设置openoffice相关组件的访问权限,
已用命令行启动OpenOffice服务:
cd C:\Program Files\OpenOffice.org 3\program
C:\Program Files\OpenOffice.org 3\program>soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard

仍然不能访问,页面大概运行一分钟才提示以上错误,望大侠能帮忙解决,万分感谢!
------解决方案--------------------
他已经告诉你创建 com.sun.star.ServiceManager 服务失败了
这个与 php 没有关系

你需要先确认你的软件是否工作正常,即在 openoffice 中是否能够转换
如果能成功,再去检查 COM+ 服务是否启动
陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
如何檢查PHP會話是否已經開始?如何檢查PHP會話是否已經開始?Apr 30, 2025 am 12:20 AM

在PHP中,可以使用session_status()或session_id()來檢查會話是否已啟動。 1)使用session_status()函數,如果返回PHP_SESSION_ACTIVE,則會話已啟動。 2)使用session_id()函數,如果返回非空字符串,則會話已啟動。這兩種方法都能有效地檢查會話狀態,選擇使用哪種方法取決於PHP版本和個人偏好。

描述一個場景,其中使用會話在Web應用程序中至關重要。描述一個場景,其中使用會話在Web應用程序中至關重要。Apr 30, 2025 am 12:16 AM

sessionsarevitalinwebapplications,尤其是在commercePlatform之前。

如何管理PHP中的並發會話訪問?如何管理PHP中的並發會話訪問?Apr 30, 2025 am 12:11 AM

在PHP中管理並發會話訪問可以通過以下方法:1.使用數據庫存儲會話數據,2.採用Redis或Memcached,3.實施會話鎖定策略。這些方法有助於確保數據一致性和提高並發性能。

使用PHP會話的局限性是什麼?使用PHP會話的局限性是什麼?Apr 30, 2025 am 12:04 AM

PHPsessionshaveseverallimitations:1)Storageconstraintscanleadtoperformanceissues;2)Securityvulnerabilitieslikesessionfixationattacksexist;3)Scalabilityischallengingduetoserver-specificstorage;4)Sessionexpirationmanagementcanbeproblematic;5)Datapersis

解釋負載平衡如何影響會話管理以及如何解決。解釋負載平衡如何影響會話管理以及如何解決。Apr 29, 2025 am 12:42 AM

負載均衡會影響會話管理,但可以通過會話複製、會話粘性和集中式會話存儲解決。 1.會話複製在服務器間複製會話數據。 2.會話粘性將用戶請求定向到同一服務器。 3.集中式會話存儲使用獨立服務器如Redis存儲會話數據,確保數據共享。

說明會話鎖定的概念。說明會話鎖定的概念。Apr 29, 2025 am 12:39 AM

Sessionlockingisatechniqueusedtoensureauser'ssessionremainsexclusivetooneuseratatime.Itiscrucialforpreventingdatacorruptionandsecuritybreachesinmulti-userapplications.Sessionlockingisimplementedusingserver-sidelockingmechanisms,suchasReentrantLockinJ

有其他PHP會議的選擇嗎?有其他PHP會議的選擇嗎?Apr 29, 2025 am 12:36 AM

PHP會話的替代方案包括Cookies、Token-basedAuthentication、Database-basedSessions和Redis/Memcached。 1.Cookies通過在客戶端存儲數據來管理會話,簡單但安全性低。 2.Token-basedAuthentication使用令牌驗證用戶,安全性高但需額外邏輯。 3.Database-basedSessions將數據存儲在數據庫中,擴展性好但可能影響性能。 4.Redis/Memcached使用分佈式緩存提高性能和擴展性,但需額外配

在PHP的上下文中定義'會話劫持”一詞。在PHP的上下文中定義'會話劫持”一詞。Apr 29, 2025 am 12:33 AM

Sessionhijacking是指攻擊者通過獲取用戶的sessionID來冒充用戶。防範方法包括:1)使用HTTPS加密通信;2)驗證sessionID的來源;3)使用安全的sessionID生成算法;4)定期更新sessionID。

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

Dreamweaver Mac版

Dreamweaver Mac版

視覺化網頁開發工具

SublimeText3 英文版

SublimeText3 英文版

推薦:為Win版本,支援程式碼提示!

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

VSCode Windows 64位元 下載

VSCode Windows 64位元 下載

微軟推出的免費、功能強大的一款IDE編輯器

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境