PHP code example of michaeldrennen / pandoc

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

    

michaeldrennen / pandoc example snippets


$pandoc = new Pandoc();
$pandoc->fromFile('./from.txt')
       ->toFile('./to.docx')
       ->convert();

$pandoc = new Pandoc();
$pandoc->content('<p>Wow, I really Cronenberged up the whole place, huh Morty?</p>')
       ->toFile('./to.docx')
       ->convert();

try{
    $pandoc = new Pandoc();
    $pandoc->fromFile('./from.txt')
           ->toFile('./to.docx')
           ->convert();
} catch(PandocException $exception) {
    echo $exception->getMessage();
}