如何編譯LibreOffice在線編輯
LibreOffice本身是沒有在線編輯的功能,如果要編譯LibreOffice在線編輯,需要編譯另外一套源碼CollaboraOnline,CollaboraOnline是基于LibreOffice為核心構(gòu)建的文檔在線編輯,編輯步驟參考以下內(nèi)容:
環(huán)境
- Linux系統(tǒng)版本:Ubantu20.04
- CollaboraOnline源碼分支:distro/collabora/co-22-05
步驟
- 打開shell命令窗口,執(zhí)行以下代碼,安裝編譯環(huán)境
sudo apt install -y dialog
sudo apt install -y libpoco-dev python3-polib libcap-dev npm \
libpam-dev wget git build-essential libtool \
libcap2-bin python3-lxml libpng-dev libcppunit-dev \
pkg-config fontconfig snapd chromium-browser
- 第二步是下載編譯好的LibreOffice core源碼,當(dāng)然也可以自己拉取LibreOffice core源碼進(jìn)行編譯,對應(yīng)的分支:distro/collabora/co-22.05,想要快速的獲取一個在線編輯,我們直接拉取官方編譯好的core就可以了,執(zhí)行以下代碼:
wget https://github.com/CollaboraOnline/online/releases/download/for-code-assets/core-co-22.05-assets.tar.gz
- 拉取成功后解壓
tar xvf core-co-22.05-assets.tar.gz
解壓成功后會看到兩個文件夾include和instdir,這兩個文件里的包將是編譯online源碼的核心。
- 拉取git上online的代碼
git clone https://github.com/CollaboraOnline/online.git
- 切換分支
git checkout distro/collabora/co-22-05
- 進(jìn)入拉取online的目錄,運行 autogen 生成配置文件:
cd online
./autogen.sh
- 執(zhí)行配置文件,檢查配置
./configure --enable-silent-rules --with-lokit-path=/data/core/include \
--with-lo-path=/data/core/instdir \
--enable-debug --enable-cypress
如果在檢查配置的過程中報錯,說明缺少對應(yīng)的環(huán)境,請根據(jù)錯誤提示,安裝對應(yīng)的環(huán)境,參考步驟1
參數(shù)說明:
參數(shù)名 | 說明 |
---|---|
–enable-silent-rules | 減少詳細(xì)構(gòu)建輸出 |
–with-lokit-path | LibreOffice core編譯生成的include包路徑 |
–with-lo-path | LibreOffice core編譯生成的instdir 包路徑 |
–enable-debug | 啟用調(diào)試模式 |
–enable-cypress | 啟用cypress test |
執(zhí)行完./configure 命令后,檢查如果沒有報錯,可以直接make或make run,make:直接構(gòu)建,不運行demo,make run編譯完成后直接運行demo。出現(xiàn)以下界面可以就證明環(huán)境檢查沒有問題,如果有問題,需要根據(jù)具體錯誤安裝對應(yīng)環(huán)境
- 執(zhí)行編譯
make run
編譯完成后,出現(xiàn)9980端口,就是編譯成功
往上滑動,可以看到測試鏈接
在這里插入圖片描述
選擇這個地址:https://localhost:9980/browser/dist/framed.doc.html?file_path=/data/holderOfficeOnline/online/test/data/hello-world.odt 其他地址訪問會出錯,打開這個地址后,正確的頁面應(yīng)該是:
點擊here and accept security bits,可以在瀏覽器中瀏覽文檔,效果如下:文章來源:http://www.zghlxwxcb.cn/news/detail-488006.html
結(jié)束語
到此,LibreOffice在線編輯文檔編譯工作就此結(jié)束,后續(xù)會持續(xù)更新如何將online嵌入到自己的業(yè)務(wù)系統(tǒng)中,如何進(jìn)行二次開發(fā)修改源碼,如果有疑問,可以留言,博主看到會回復(fù)。文章來源地址http://www.zghlxwxcb.cn/news/detail-488006.html
到了這里,關(guān)于Linux下編譯LibreOffice在線編輯的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!