PHP code example of dmitry-kuchura / pdf-to-html-php

1. Go to this page and download the library: Download dmitry-kuchura/pdf-to-html-php 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/ */

    

dmitry-kuchura / pdf-to-html-php example snippets


\Gswits\PdfToHtml\Config::set('pdftohtml.bin', '/usr/local/bin/pdftohtml');

\Gswits\PdfToHtml\Config::set('pdfinfo.bin', '/usr/local/bin/pdfinfo');

namespace App\Http\Controllers;

use Kuchura\PdfToHtml\Config;
use Kuchura\PdfToHtml\Pdf;

class PdfController
{
    public function pdf()
    {
        Config::set('pdftohtml.bin', '/usr/bin/pdftohtml');
        Config::set('pdfinfo.bin', '/usr/bin/pdfinfo');

        $pdf = new Pdf(public_path() . '/test.pdf');

        $html = $pdf->html();
    }
}

$pdfDom = $pdf->getDom(['ignoreImages' => true]);
json
{
  "dmitry-kuchura/pdf-to-html-php": "^2.0.*"
}