PHP code example of lukaswhite / document-converter

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

    

lukaswhite / document-converter example snippets


use Lukaswhite\DocumentConverter\Converter;

$converter = new Converter('/path/to/document.doc');
$converter->toPDF();

$converter->outputAs('converted')->toPDF();

$converter->outputTo('/path/to/converted/files')->toPDF();

$converter->outputAs('converted')
    ->outputTo('/path/to/converted/files')
    ->toPDF();

$converter->toFormat('doc');

$result = $converter->toPDF();

$result->getFilepath(); // e.g. /path/to/document.pdf
$result->getFilename(); // e.g. document.pdf
$result->getExtension(); // e.g. pdf