micaheldrennen / pandoc
一个围绕 Pandoc 文件转换软件的 PHP 7 兼容包装器。
v1.03
2018-02-26 19:30 UTC
Requires (Dev)
- phpunit/phpunit: ^6.5
- satooshi/php-coveralls: ^2.0
This package is auto-updated.
Last update: 2024-09-10 05:51:12 UTC
README
PHP 7 兼容的 Pandoc 包装器 (https://github.com/jgm/pandoc)
使用方法
从文件 -> 到文件
$pandoc = new Pandoc(); $pandoc->fromFile('./from.txt') ->toFile('./to.docx') ->convert();
字符串内容 -> 到文件
$pandoc = new Pandoc(); $pandoc->content('<p>Wow, I really Cronenberged up the whole place, huh Morty?</p>') ->toFile('./to.docx') ->convert();
带有异常处理
try{ $pandoc = new Pandoc(); $pandoc->fromFile('./from.txt') ->toFile('./to.docx') ->convert(); } catch(PandocException $exception) { echo $exception->getMessage(); }