PHP code example of breadlesscode / office-converter

1. Go to this page and download the library: Download breadlesscode/office-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/ */

    

breadlesscode / office-converter example snippets


use \Breadlesscode\Office\Converter;

Converter::file('Test.odt') // select a file for convertion
    ->setLibreofficeBinaryPath('/usr/bin/libreoffice') // binary to the libreoffice binary
    ->setTemporaryPath('./temp') // temporary directory for convertion
    ->setTimeout(100) // libreoffice process timeout
    ->save(__DIR__.'/lorem.pdf'); // save as pdf

use Breadlesscode\Office\Converter;

Converter::file('./Test.odt')
    ->save('./lorem', 'jpg');

use Breadlesscode\Office\Converter;

Converter::file('./Test.odt')
    ->save('./lorem.jpg');