0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

LibreOffice で pdf 自動作成するための環境構築 in Ubuntu24.04 LTS

Last updated at Posted at 2025-12-15

関連記事も併せてご覧ください
「LibreOffice を利用して Webアプリなどから PDF 文書生成 記事 INDEX」
https://qiita.com/nanbuwks/items/9cddc154f2d21c891ca5

知見を最新の環境で整理。

環境

  • Ubuntu 24.04 LTS
  • Desktop 環境をインストール
  • 日本語環境を選択

追加インストール

$ sudo apt install libreoffice libreoffice-java-common default-jre
  • java 実行環境が必要なので、default-jre をインストール
  • libreoffice-java-common libreoffice の java
  • OSインストール時にLibreOfficeインストールを選択していなかった場合は、libreoffice をインストール。

Web 環境から pdf 化するための権限設定

php, apache などをインストールしておき、
pdf 化するためのスクリプトを配置しておきます。

cf.,「WebアプリでPDF文書を自動生成 on Ubuntu20.04 LTS」
https://qiita.com/nanbuwks/items/f11e4e3aabac33f9a32b

LibreOffice を www-data で動かす

プロファイルなどが /var/www に生成されるため、以下のように設定しておきます。

$ sudo chown www-data:www-data /var/www

トラブルシューティング

/var/log/apache2/error.log に出現するエラー

Error: source file could not be loaded

以下で対処

$ sudo apt install libreoffice 

javaldx failed!

javaldx failed!
Warning: failed to read path from javaldx

/var/www/libreoffice が作成できないため。以下で対処。

$ sudo chown www-data:www-data /var/www

User installation could not be completed.

(process:5343): dconf-CRITICAL **: 10:51:18.232: unable to create directory '/var/www/.cache/dconf': Permission denied.  dconf will not work properly.
LibreOffice 24.2 - Fatal Error: The application cannot be started. 
User installation could not be completed. 

/var/www/.cache/dconf が作成できないため。これも以下で対処。

$ sudo chown www-data:www-data /var/www
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?