lukaswhite/document-converter
最新稳定版本:0.0.1
Composer 安装命令:
composer require lukaswhite/document-converter
包简介
README 文档
README
A PHP wrapper around Libreoffice for converting documents from one format to another.
For example:
- Microsoft Word to PDF
- OpenOffice to Microsoft Word
- PDF to HTML
- ...and many more
Installation
IMPORTANT: You must have Libreoffice installed.
Using composer:
composer require lukaswhite/document-converter
Usage
use Lukaswhite\DocumentConverter\Converter; $converter = new Converter('/path/to/document.doc'); $converter->toPDF();
All being well, this should create a file named document.pdf in the same folder.
To customize the filename:
$converter->outputAs('converted')->toPDF();
...or the output path:
$converter->outputTo('/path/to/converted/files')->toPDF();
You can of course combine these:
$converter->outputAs('converted') ->outputTo('/path/to/converted/files') ->toPDF();
For other formats:
$converter->toFormat('doc');
Return Format
The conversion method returns an object that contains information about the conversion:
$result = $converter->toPDF(); $result->getFilepath(); // e.g. /path/to/document.pdf $result->getFilename(); // e.g. document.pdf $result->getExtension(); // e.g. pdf
统计信息
- 总下载量: 5.19k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-28