Code Monkey home page Code Monkey logo

Comments (12)

sandeep0075 avatar sandeep0075 commented on July 30, 2024 1

finally thanks @mgufrone this is the working code i have

Config::set('/usr/bin/pdftohtml.bin', '/var/www/html/poppler-0.51/bin/pdftohtml.exe');

// change pdfinfo bin location
Config::set('/usr/bin/pdfinfo.bin', '/var/www/html/poppler-0.51/bin/pdfinfo.exe');

thanks a lot

from pdf-to-html.

mgufrone avatar mgufrone commented on July 30, 2024

These codes :

\Gufy\PdfToHtml\Config::set('pdftohtml.bin', '/pdf/');
\Gufy\PdfToHtml\Config::set('pdfinfo.bin', '/pdf/');

are supposed to determine where you locate pdftohtml binary file. so you should appoint it to the binary file, not the directory.

To find it out, you should use

which pdftohtml
which pdfinfo

then use each of locations and insert to the code above. You got what i mean? ๐Ÿ‘

from pdf-to-html.

ThomasRalee avatar ThomasRalee commented on July 30, 2024

@mgufrone,
thanks for the reply. I have updated installed Poppler-Utils and updated my codes according to

which pdftohtml
which pdfinfo

Like this

\Gufy\PdfToHtml\Config::set('pdftohtml.bin', '/usr/local/bin/pdfinfo');
\Gufy\PdfToHtml\Config::set('pdfinfo.bin', '/usr/local/bin/pdftohtml');
$pdf = new \Gufy\PdfToHtml\Pdf('/home/vagrant/Code/fyp/public/pdf/testing.pdf');

but it returns this error

ErrorException in Pdf.php line 51:
Undefined index: pages

and when i dd($pdf); it returns null

Can you guide me on the right way of calling the pdf file?
Appreciate your help

Cheers
Ralee

from pdf-to-html.

mgufrone avatar mgufrone commented on July 30, 2024

I believe you accidentally flip this code

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

It suppose to be like this

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

Try it again, if it still gives you error, i will check it again.

from pdf-to-html.

ThomasRalee avatar ThomasRalee commented on July 30, 2024

Hey @mgufrone,

Nope flipping it doesnt work. Thanks for helping me.
Same error

ErrorException in Pdf.php line 51:
Undefined index: pages

Cheers,
Ralee

from pdf-to-html.

ThomasRalee avatar ThomasRalee commented on July 30, 2024

Hey @mgufrone,

Any news?

Cheers
Ralee

from pdf-to-html.

mgufrone avatar mgufrone commented on July 30, 2024

will give you notice again on a weekend. i hope it will be good news for you.

from pdf-to-html.

ThomasRalee avatar ThomasRalee commented on July 30, 2024

@mgufrone,

I managed to have it worked. I installed poppler utils on my local instead of my virtual machine... Great its working now! Do you know how i can retrieve the html content?

screen shot 2015-10-09 at 12 41 17 am

Great library btw. I am gonna star it now.

Cheers
Ralee

from pdf-to-html.

mgufrone avatar mgufrone commented on July 30, 2024

Glad you made it @ThomasRalee ๐Ÿ‘
Thank you for using this library.

from pdf-to-html.

afzydev avatar afzydev commented on July 30, 2024

Hi @mgufrone

Thanks for the great script .

I am getting the same error as above.I have installed sudo apt-get install poppler-utils on local machine.But still getting the same error can you please tell me what else i have to do to convert from PDF to HTML?

Here is code

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


    $viewPdf=public_path().'/assets/uploads/pdf/1dummy.pdf';

    // initiate
    $pdf = new Pdf($viewPdf);

    // convert to html string
    $html = $pdf->html();

from pdf-to-html.

leena123 avatar leena123 commented on July 30, 2024

@ThomasRalee can you please tell me all the configuration settings has been done for using it with laravel
Thanks in advance!!

from pdf-to-html.

jineshsubedi avatar jineshsubedi commented on July 30, 2024

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>

<?php
use \Gufy\PdfToHtml\Pdf;
use \Gufy\PdfToHtml\Html;

$viewPdf= storage_path('app/public/sample2.pdf');
$pdf = new \Gufy\PdfToHtml\Pdf($viewPdf);

\Gufy\PdfToHtml\Config::set('pdftohtml.bin',storage_path('/app/public/poppler/bin/pdftohtml.exe'));
\Gufy\PdfToHtml\Config::set('pdfinfo.bin',storage_path('/app/public/poppler/bin/pdfinfo.exe'));

$pdf = new Pdf($viewPdf);
$pdfDom = $pdf->getDom(['ignoreImages' => true]);
// convert to html string
$html = $pdf->html();
$dom = $pdf->getDom();
$total_pages = $pdf->getPages();
$paragraphs = $dom->find('body > p');
echo $html;
echo $total_pages;
// echo $paragraphs;
?>
</body>
</html>

worked for me!
download poppler from here - https://blog.alivate.com.au/poppler-windows/

-happy coding jineshsubedi.com.np

from pdf-to-html.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.