You are on page 1of 2

2009年8月9日 星期日 首頁 -> 年份: 2009 -> 月份: 00

用Xvfb讓OpenOffice開 時自動 動

使用DSpace的media filter 能時, 要把 種 件 轉換成PDF 件,這個 能可以藉由OpenOffice來完成。但

是OpenOffice必 在圖形介面(也就是Xwindow)中才能開 ,在無法自動 動的情況下,實在是不太方便。在

網 上 尋 種方法 後,終於找到方法了。

致上作法如下:利用Xvfb來製作出虛擬的圖形 示畫面,然後讓OpenOffice在這虛擬的介面開 ,就可以正

動OpenOffice並提供轉 能了。

我的作業系統是CentOS 5 Final,以下開始介紹安裝方法。

一、安裝Xvfb

可以利用yum來安裝Xvfb:(注意 小 要正確 )

[root@ ~] yum install Xvfb

二、安裝OpenOffice

在安裝CentOS的時候我已 把OpenOffice安裝。如果 沒有安裝,那 也可以利用yum來安裝OpenOffice:

[root@ ~] yum install openoffice.org-*

注意找尋一下 OpenOffice的安裝 徑,我們 要呼叫他的執行程式「soffice.bin」。 可以利用locate 令

來 尋soffice.bin看是放在 裡 徑底下:

[root@ ~] locate /soffice.bin

CentOS預設安裝是擺在「/usr/lib/openoffice.org/program/soffice.bin」當中, 住這個 徑,在底下設定時 使

用到 !

三、設定 動時開 OpenOffice 件轉換服務

請建立「/etc/init.d/openoffice」,並設定執行權 為755。/etc/init.d/openoffice的 內容如下:

01. #!/bin/bash
02.
03. case "$1" in
04. start)
05. DISPLAY=:5.0
06. export DISPLAY
07. Xvfb :5 -screen scrn 1024x768x24 &
08. /opt/openoffice.org3/program/soffice.bin "-
accept=socket,host=127.0.0.1,port=8100;urp;StarOffice.ServiceManager -nofirststartwizard -
nologo -headless -display:5" &
09. ;;
10. stop)
11. pkill soffice &
12. pkill Xvfb &
13. exit 1 &
14. ;;
15. *)
16. echo "Usage: $0 { start | stop }"
17. exit 1
18. ;;
19. esac
20. exit 0

注意到上面的「/usr/lib/openoffice.org/program/soffice.bin」的 徑,請改成 系統安裝OpenOffice的 徑 !

參 資料:

建 件格式 服 器
How to install Xvfb (X11 Server) in Linux Server

相關連結:

DSpace 編輯語系 能 - 2009-05-26


DSpace擴 MediaFilter(BitstreamDisplay使用篇) - 2009-05-20
讓VirtualBox的VRDP連線的滑鼠同 - 2009-03-11
PostgreSQL連線設定 DSpace資料庫備份設定 - 2009-03-03
SFTP連線設定教 ——以FileZilla Potable為例 - 2008-10-31

2 意見:

Wa Pa 提到...

謝謝 的分 ,請 我要怎 做才能讓這個服務去轉我的 ?把 丟到一個 方 ? 還是要下什 令


給 ?

2009年9月8日 上午 11:01
布丁布丁吃布丁 提到...

詳情請看JODConverter或是OpenOffice相關的 件吧!

2009年9月8日 下午 2:38

You might also like