mgufrone / pdf-to-html

PDF to HTML PHP Class using Poppler-Utils
MIT License
175 stars 88 forks source link

Class 'Gufy\PdfToHtml\Config' not found #55

Open anonymouse703 opened 5 years ago

anonymouse703 commented 5 years ago

How to solve this?

I followed the docs..

I put use Gufy\PdfToHtml\Config; at the top and this is my controller

public function convertPdf(Request $request){

        // dd($request->all());    

        // change pdftohtml bin location
        \Gufy\PdfToHtml\Config::set('pdftohtml.bin', 'C:/wamp64/www/iaccs-admin-console/public/bin/pdftohtml.exe');

        // change pdfinfo bin location
        \Gufy\PdfToHtml\Config::set('pdfinfo.bin', 'C:/wamp64/www/iaccs-admin-console/public/bin/pdfinfo.exe');
        // initiate
        $pdf = new Gufy\PdfToHtml\Pdf($request);

        // convert to html and return it as [Dom Object](https://github.com/paquettg/php-html-parser)
        $html = $pdf->html();

        // check if your pdf has more than one pages
        $total_pages = $pdf->getPages();

        // Your pdf happen to have more than one pages and you want to go another page? Got it. use this command to change the current page to page 3
        $html->goToPage(1);

        // and then you can do as you please with that dom, you can find any element you want
        $paragraphs = $html->find('body > p');

        return $paragraphs;

    }