跳到主要内容

安装 Document Builder

ONLYOFFICE Document Builder 可安装在多种平台上,用于生成、编辑和转换 Office 及 PDF 文档。

注意

ONLYOFFICE Document Builder 的免费版本会在所有生成的文档上添加水印。要去除此限制并使用全部功能,需要商业许可证。

如需购买详情,请通过 sales@onlyoffice.com 与我们联系。

先决条件

  • Python 3.10 - 3.12
  • pip3。确保系统中已安装 python3pip3。您可以在终端中使用以下命令检查 Python 版本和 pip3 版本:
python3 --version
python3 -m pip --version
备注

在 Windows 系统上使用 pippython。确保可执行文件名为 python.exe(Windows 系统默认),且 Python 已添加到 path 环境变量中。

如果需要安装它们,可以使用以下命令:

sudo apt install python3 python3-pip
信息

对于 macOS,您可以使用 Homebrew 安装 python3pip3,命令如下:

brew install python3

安装步骤

下载 SDK。

备注

对于 Python,您可以在终端中使用 pip3 安装 document-builder 库:

pip3 install document-builder

运行示例

下载 document-builder 示例

git clone https://github.com/ONLYOFFICE/document-builder-samples
cd document-builder-samples
  1. 执行 configure.py 并带上 --test python 参数:

    python3 configure.py --test python

    必要时,使用 --dir 参数提供 Document Builder 的目录。 这是生成包含 Document Builder 路径的辅助模块所必需的。

  2. 进入测试目录:

    cd python/creating_basic_form
  3. 运行脚本:

    python3 main.py

文档将在测试目录中创建。