yigit-serin / office-converter
LibreOffice的PHP包装器
v0.1.4
2018-07-05 14:38 UTC
Requires
- php: >=5.5.9
- ncjoes/office-converter: ^0.1.3
Requires (Dev)
- phpunit/phpunit: 5.5.*
Replaces
- ncjoes/office-converter: v0.1.4
This package is auto-updated.
Last update: 2024-09-29 04:49:00 UTC
README
####LibreOffice的PHP包装器
使用LibreOffice或OpenOffice将办公文件转换为PDF和HTML。支持的转换格式包括
- pptx > pdf
- ppt > pdf
- pdf > pdf
- docx > pdf, odt, html
- doc > pdf, odt, html
- xlsx > pdf
- xls > pdf
安装
建议通过Composer安装OfficeConverter。
在您的项目目录中运行以下命令
composer require ncjoes/office-converter
或者将此行添加到您的composer.json
{ "ncjoes/office-converter": "0.1.*" }
依赖项
为了使用OfficeConverter,您需要安装LibreOffice。
使用方法
以下是一些示例。
<?php // if you are using composer, just use this use NcJoes\OfficeConverter\OfficeConverter; $converter = new OfficeConverter('test-file.docx'); $converter->convertTo('output-file.pdf'); //generates pdf file in same directory as test-file.docx $converter->convertTo('output-file.html'); //generates html file in same directory as test-file.docx //to specify output directory, specify it as the second argument to the constructor $converter = new OfficeConverter('test-file.docx', 'path-to-outdir'); ?>
许可证
OfficeConverter软件包是开源软件,采用MIT许可证。
反馈 & 贡献
通知我任何问题、错误或改进。谢谢 👍