PHPackages                             yowfung/officetopdf - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. yowfung/officetopdf

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

yowfung/officetopdf
===================

This is a PHP Laravel library, which uses LibreOffice built-in command to convert Office documents(such as doc, docx, xls, xlsx, ppt, pptx, wps, dwg and so on) to PDF files.

v1.0.6(8y ago)216193MITPHPPHP ^5.3.3 || ^7.1

Since Dec 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/YowFung/officetopdf)[ Packagist](https://packagist.org/packages/yowfung/officetopdf)[ Docs](http://www.yowfung.cn)[ RSS](/packages/yowfung-officetopdf/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (2)Used By (0)

yowfung/officetopdf
===================

[](#yowfungofficetopdf)

​ This is a PHP Laravel library, which uses LibreOffice built-in command to convert Office documents (such as doc, docx, xls, xlsx, ppt, pptx, wps, dwg and so on) to PDF files.

​ 这是一个PHP Laravel库，它使用LibreOffice内置命令将Office文档(如doc、docx、xls、xlsx、ppt、pptx、wps、dwg等)转换为PDF文件。

Installation
------------

[](#installation)

​ 使用Composer安装，在终端上运行命令：`composer require yowfung/officetopdf`。或在`composer.json`中添加以下代码：

```
{
    "require": {
        "yowfung/officetopdf": "^1.0"
    }
}
```

Configure
---------

[](#configure)

​ 本库利用LibreOffice内置的命令实现格式转换，因此在使用本库前必须保证服务器环境为Linux系统，且已配置Java环境，并安装LibreOffice软件。

- 配置Java环境：可直接运行本库自带的Java环境安装配置脚本：

```
./src/build-java-environment.sh
```

- 安装LibreOffice：可直接运行本库自带的LibreOffice安装脚本：

```
./src/install-libreoffice.sh
```

Examples
--------

[](#examples)

以下提供简单的使用案例：

```
