Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 1.08 KB

README.md

File metadata and controls

43 lines (31 loc) · 1.08 KB

PHP wrapper over Unoconv

Simple way for documents conversion into various formats.

For example: html -> docx, html -> pdf, docx -> html and many more.

More about supported formats.

Usage

use Mnvx\Unoconv\Converter;
use Mnvx\Unoconv\UnoconvParameters;
use Mnvx\Unoconv\Format;

// Create converter
$converter = new Converter();

// Describe parameters for converter
$parameters = (new UnoconvParameters())
    // HTML document as string on input
    ->setInputStream('<!DOCTYPE html><html>Example of HTML document</html>')
    // Result file name
    ->setOutputFile('path-to-result-docx.docx')
    // Format of result document is docx
    ->setOutputFormat(Format::FORMAT_TEXT_DOCX);

// Run converter
$converter->convert($parameters);

Install

sudo apt-get install unoconv
composer require mnvx/unoconv

If you have problems with Unoconv utility, read instructions descibed in official documentation.

License

Released under the MIT license