PHP code example of midi / document-converter

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

    

midi / document-converter example snippets


$service = new DocumentConverter('/tmp/1.pdf');
$service->fileToImage()

// image save dir : /usr/tmp/a/dir
// image save ext : jpg
// image background : green
// image background : green
// read source file resolution : 100
// save image quality : 90
$service = new DocumentConverter('/tmp/1.pdf', '/usr/tmp/a/dir', 'jpg', 'green', 100, 90);
$service->fileToImage()

$service = new DocumentConverter('/tmp/1.docx');
$service->fileToImage()

$service = new DocumentConverter('/tmp/1.pptx');
$pdfPath = $service->fileToPdf()

[
    'total_page' => 4,
    'success_total' => 3,
    'fail_total' => 1,
    'success_page' => [
        '/tmp/1.jpg',
        '/tmp/2.jpg',
        '/tmp/4.jpg',
    ],
    'success_page' => [
        '/tmp/1.jpg',
        '/tmp/2.jpg',
    ],
    'fail_page' => [
        '/tmp/3.jpg',
    ]
]

'/tmp/a/b/c/d/1.pdf'

DocumentConverterException