PHP code example of viterbit / liboffice-converter

1. Go to this page and download the library: Download viterbit/liboffice-converter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

viterbit / liboffice-converter example snippets


use Viterbit\LibOfficeConverter\Converter;
use Viterbit\LibOfficeConverter\Parameters;
use Viterbit\LibOfficeConverter\Format;

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

// Describe parameters for converter
$parameters = (new Parameters())
    // HTML document
    ->setInputFile('test.html')
    // Format of result document is docx
    ->setOutputFormat(Format::TEXT_DOCX)
    // Result file name
    ->setOutputFile('path-to-result-docx.docx');

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