PHP code example of jaybizzle / doc-to-text

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

    

jaybizzle / doc-to-text example snippets




use Jaybizzle\DocToText\Doc;

echo Doc::getText('book.doc'); // returns the text from the doc

$text = (new Doc())
    ->setDoc('book.doc')
    ->text();

echo Doc::getText('book.doc');

$text = (new Doc('/custom/path/to/antiword'))
    ->setDoc('book.doc')
    ->text();

echo Doc::getText('book.doc', '/custom/path/to/antiword');

$text = (new Doc())
    ->setDoc('table.doc')
    ->setOptions(['f', 'w 80'])
    ->text()
;

echo Doc::getText('book.doc', null, ['f', 'w 80']);
bash
which antiword