mgufrone / pdf-to-html

PDF to HTML PHP Class using Poppler-Utils
MIT License
176 stars 89 forks source link

not work in server #18

Closed rossip89 closed 8 years ago

rossip89 commented 8 years ago

Hello @mgufrone , I have a problem uploading my project to the server. I comment to you. It worked perfectly on my local Windows machine using this code:

<?php include 'vendor/autoload.php'; use Gufy\PdfToHtml\Config; Config::set('pdftohtml.bin', __DIR__.'/Poppler/bin/pdftohtml.exe'); Config::set('pdfinfo.bin', __DIR__.'/Poppler/bin/pdfinfo.exe'); $p = 'sample.pdf'; $pdf = new Gufy\PdfToHtml\Pdf($p); $pdf->html(); ?> But unfortunately the PHP code will run on Linux server where exe files could not run on. So I found there is a usage note for OS/X and Debian/Ubuntu to use:

Config::set('pdftohtml.bin', __DIR__.'/usr/local/bin/pdftohtml'); Config::set('pdfinfo.bin', __DIR__.'/usr/local/bin/pdfinfo');

Instead of:

Config::set('pdftohtml.bin', __DIR__.'/Poppler/bin/pdftohtml.exe'); Config::set('pdfinfo.bin', __DIR__.'/Poppler/bin/pdfinfo.exe');

I appreciate your help

mgufrone commented 8 years ago

You can't install this package unless you have full access to your server. If you are in shared hosting and your provider is a good partner to you, try to ask them to install the package of poppler-utils on th server.

To determine where is the exact location of pdfinfo and pdfhtml on linux-based server, you can do this

which pdfinfo
which pdfhtml

You will get the location of each binaries if you have already installed poppler-utils properly on your server.

rossip89 commented 8 years ago

thanks for answering, there will be a way to install it myself, the server provider almost not answer me and I need urgent

rossip89 commented 8 years ago

I tell you that I found the method to execute, simply use the following line

shell_exec("/usr/bin/pdftohtml mypdf.pdf $output_folder/mypdf 2>&1")

thanks for your help.