Selected Category: Linux Memo (35)

View Mode: Post List Post Summary
[Reference] Convert MS/Word to PDF

這是利用 OpenOffice.org 的巨集來把 DOC 檔轉成 PDF 檔的方法,好處是也可以用在 shell script 裡,一次把好幾個檔案轉成 PDF 檔,做法及用法如下:

撰寫 OpenOffice.org 的巨集
  1. 打開 OOWriter,點選工具列上的「工具」「巨集」「組織巨集」「OpenOffice.org Basic」
  2. 有巨集來源那邊點選「我的巨集」下的「Standard」「Module1」,再點一下右邊的編輯來編輯 Module
  3. 之後會跳出一個視窗,在視窗內輸入以下的 code 後存檔就可以把 OpenOffice.org 關掉了。 
    REM ***** BASIC *****

    Sub ConvertWordToPDF(cFile)
    cURL = ConvertToURL(cFile)

    ' Open the document.
    ' Just blindly assume that the document is of a type that OOo will
    ' correctly recognize and open -- without specifying an import filter.
    oDoc = StarDesktop.loadComponentFromURL(cURL, "_blank", 0, Array(MakePropertyValue("Hidden", True), ))

    cFile = Left(cFile, Len(cFile) - 4) + ".pdf"
    cURL = ConvertToURL(cFile)

    ' Save the document using a filter.
    oDoc.storeToURL(cURL, Array(MakePropertyValue("FilterName", "writer_pdf_Export"), ))

    oDoc.close(True)

    End Sub

    Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
    Dim oPropertyValue As New com.sun.star.beans.PropertyValue
    If Not IsMissing( cName ) Then
    oPropertyValue.Name = cName
    EndIf
    If Not IsMissing( uValue ) Then
    oPropertyValue.Value = uValue
    EndIf
    MakePropertyValue() = oPropertyValue
    End Function
撰寫 shell script
  1. 把下列 code 存成 shell script,檔名可以取成 doc2pdf。
    #!/bin/sh

    DIR=$(pwd)
    DOC=$DIR/$1

    /usr/bin/oowriter -invisible "macro:///Standard.Module1.ConvertWordToPDF($DOC)"
  2. 加上執行的權限
    sudo chmod +x doc2pdf
  3. 移到 /usr/local/bin
    sudo mv doc2pdf /usr/local/bin
用法
在 Command Line 輸入 doc2pdf test.doc 就會輸出 test.pdf 了。

Posted by cookeyholder at 痞客邦 PIXNET Comments(2) Trackback(0) Hits(656)

利用 Google Pages 做了一個網頁,上頭放了幾個我安裝 Ubuntu 時用得到的檔案。

Posted by cookeyholder at 痞客邦 PIXNET Comments(0) Trackback(0) Hits(101)

剛剛在 Ubuntu 正體中文站看到 PCMan 貼的文章《LXDE - 輕量級 X11 桌面環境,開發版本搶先預覽》,看完以後超興奮的,之前就想試試 LXDE(Lightweight X11 Desktop Environment) 的,可惜裝不起來所以作罷,在遲了一年之後 LXDE 又回來了!如果想要看 screenshot 可以到 Ubuntu Forums 看 PCMan 貼的文章

更方便的是這次 PCMan 為 Debian 以及 Ubuntu 的 user 寫了一個自動安裝的 shell script!待會兒就用 VirtualBox 來試試。尤其 screenshot 看起來特別簡潔以及有效率,讓人看了就有要安裝的衝動,我都快等不及了呢!

那支自動安裝的 shell script 用法如下:
抓下 shell script 後,新增一個目錄給它,並予以可執行的權限
chmod +x install-lxde-ubuntu.sh
以 root 執行 shell script
sudo ./install-lxde-ubuntu.sh

Posted by cookeyholder at 痞客邦 PIXNET Comments(0) Trackback(0) Hits(1047)

Ubuntu 正體中文站 看到的解決方法,來做個筆記。

開機的 usplash 變黑的 Bug 和螢幕解析度有關,只在用 Desktop CD 安裝的時候會遇到。原因是因為安裝程式會偵測螢幕解析度,但是 usplash 沒辦法用那麼高的解析度顯示,於是就黑掉了

解法,例如我的 Monitor 是 1280x1024,但是 usplash 可能只能用 1024x768 跑,到 /etc/usplash.conf 中將

xres=1280
yres=1024

改成

xres=1024
yres=768

然後再打

sudo update-initramfs -u -k `uname -r`

更新一下就應該可以看到了。

Posted by cookeyholder at 痞客邦 PIXNET Comments(0) Trackback(0) Hits(94)

目前還沒有用到,不過先把教學留起來。

[分享] 在Linux使用IE + Java (ies4linux + JRE1.5.0.11) 
wine 的中文 

Posted by cookeyholder at 痞客邦 PIXNET Comments(0) Trackback(0) Hits(78)