Comments (29)
Config::set('pdftohtml.bin', 'poppler-0.37/bin/pdftohtml.exe');
Assuming you have installed the poppler-utils. The code above, please use the absolute path instead of relative path.
from pdf-to-html.
Thanks it's a path problem. I have set full path and currently no error is showing. But the page is blank.
// change pdftohtml bin location
Config::set('pdftohtml.bin', 'C:/xampp/htdocs/pdf-to-html-master/poppler-0.37/bin/pdftohtml.exe');
// change pdfinfo bin location
Config::set('pdfinfo.bin', 'C:/xampp/htdocs/pdf-to-html-master/poppler-0.37/bin/pdfinfo.exe');
// initiate
from pdf-to-html.
Hai, can you give me your pdf you're using? i would like to test it on my device, too.
from pdf-to-html.
Hi @mgufrone ,
I am using a mac with a local version of my site on mamp, I am using the code below to run a test on a 5 page pdf:
html(); echo $html; ``` ?>This is the response I am getting:
Notice: Undefined index: pages in /Users/Tin/Documents/Work/flipswitch-framework/vendor/gufy/pdftohtml-php/src/Pdf.php on line 51
Fatal error: Uncaught exception 'Exception' with message 'You're asking to go to page 1 but max page of this document is 0' in /Users/Tin/Documents/Work/flipswitch-framework/vendor/gufy/pdftohtml-php/src/Html.php:58 Stack trace: #0 /Users/Tin/Documents/Work/flipswitch-framework/vendor/gufy/pdftohtml-php/src/Html.php(53): Gufy\PdfToHtml\Html->goToPage(1) #1 /Users/Tin/Documents/Work/flipswitch-framework/vendor/gufy/pdftohtml-php/src/Html.php(12): Gufy\PdfToHtml\Html->getContents('http://localhos...') #2 /Users/Tin/Documents/Work/flipswitch-framework/vendor/gufy/pdftohtml-php/src/Pdf.php(40): Gufy\PdfToHtml\Html->__construct('http://localhos...') #3 /Users/Tin/Documents/Work/flipswitch-framework/vendor/gufy/pdftohtml-php/src/Pdf.php(44): Gufy\PdfToHtml\Pdf->getDom() #4 /Users/Tin/Documents/Work/flipswitch-framework/code/code.home.php(15): Gufy\PdfToHtml\Pdf->html() #5 /Users/Tin/Documents/Work/flipswitch-framework/pages/header.php(49): include_once('/Users/Tin/Docu...') #6 /Users/Tin/Documents/Work/flipswitch-framework/inc/ in /Users/Tin/Documents/Work/flipswitch-framework/vendor/gufy/pdftohtml-php/src/Html.php on line 58
Please could you help me out as this is really urgent!
Thanks in advance.
from pdf-to-html.
@sarathiscookie Please if you could help me?
from pdf-to-html.
@KenFlip have you installed poppler-utils? if you haven't, please use this command below
brew install poppler
from pdf-to-html.
Hi,
I ran that command and it installed a lot of things what folder was i supposed to run the command in?
Kindest Regards
Kenton
from pdf-to-html.
So I ran it again just incase in my localhost root directory and in my actual site root directory and both times i got this:
Warning: poppler-0.43.0 already installed
from pdf-to-html.
It doesn't matter where you run the command in. It will install on the global directory. Okay, next is check if you have properly installed the required package.
which pdfinfo
which pdftohtml
if it is the same location as your code, the code you wrote up there will run fine
from pdf-to-html.
Ran those two:
which pdfinfo gives me: /usr/local/bin/pdfinfo
which pdftohtml gives me: /usr/local/bin/pdftohtml
My code is:
// change pdftohtml bin location
\Gufy\PdfToHtml\Config::set('pdftohtml.bin', '/usr/local/bin/pdftohtml');
// change pdfinfo bin location
\Gufy\PdfToHtml\Config::set('pdfinfo.bin', '/usr/local/bin/pdfinfo');
from pdf-to-html.
So, how was it? still not working or else?
from pdf-to-html.
Still not working at all...
Giving me that same error
from pdf-to-html.
I can send you the pdf if you would like... my end goal out of this, is the user must be able to download a pdf form. fill it out upload it to the site and get a results page containing some of the information from the uploaded pdf...
If that makes sense.
When they fill it out, the pdf will have input fields and stuff like that, so not writing or anything
from pdf-to-html.
Okay, send me the pdf to my email. I will check it out. :3
from pdf-to-html.
so if I have a plain text pdf will that work?
from pdf-to-html.
Yap, static pdf will work.
from pdf-to-html.
Could you possibly email me a plain text pdf that works on your system, I just want to see if I can get this work on my side. I can try convert the pdf form to a plain text pdf and then run t through
from pdf-to-html.
Hang on a sec, do you run your code through browser? or just from command line?
from pdf-to-html.
through a browser
from pdf-to-html.
That pdf you sent me doesnt work...
from pdf-to-html.
Oh. PHP, by default, disable shell_exec command, that is needed by the package. You should enable shell_exec function to run the package command.
from pdf-to-html.
Have no idea how to do that or even where to do that...
from pdf-to-html.
Hello!
I was fighting many hours with this library (was getting the same error, that guys before).
After long time of debuging I noticed that $content in Pdf.php:22 is empty.
Finally added 2>&1 to the shell command, so I got:
$content = shell_exec($this->bin()." '".$this->file."' 2>&1");
Content then was able to get errors.
What finally turned out, the system could not see my pdf, even though the path was full and correct.
I was getting 'I/O Error: Couldn't open file ''test.pdf'': No error.
Removed the ' ' from the code so I got: $content = shell_exec($this->bin()." ".$this->file);
And voila! $content is now filling up with data.
But I started to getting warnings with getting html output like "(...)test-1.html: failed to open stream: No such file or directory" [src/Html.php:36]
Weird thing is, that the displayed path exists! When copy-pasting it to the explorer I can see the HTML file. Sample path is: C:_MY_FILES\PROJECTS\eclipse_workspace\htdocs\My_Project\vendor\gufy\pdftohtml-php\src/../output/57ea99fab3250/test-1.html
When opened it manually I can see the file content as "something failed". Probably two new problems. One with path somehow, second that parsed html is not generated. No power to continue this fight. :-|
(Windows 10)
from pdf-to-html.
I have follow all step, but i get still error, which posted below
Fatal error: Uncaught exception 'Exception' with message 'You're asking to go to page 1 but max page of this document is 0' in D:\wamp\www\test\pdftohtml\vendor\gufy\pdftohtml-php\src\Html.php on line 63
Fatal error: Uncaught exception 'Exception' with message 'You're asking to go to page 1 but max page of this document is 0' in D:\wamp\www\test\pdftohtml\vendor\gufy\pdftohtml-php\src\Html.php on line 63
I am using window system and download poppler from http://blog.alivate.com.au/poppler-windows/
Directory structure as below
poppler
/bin/
vendor
/all required vendor
I am not getting about below step
$ which pdfinfo
/usr/local/bin/pdfinfo
$ which pdftohtml
/usr/local/bin/pdfinfo
Is it required to install? If yes, then how to install in window system? Because in cmd "which" command not working.
Please provide me needful solutions.
from pdf-to-html.
@jimeshgajera Have you read this part? If so, have you change the binary location on the configuration?
from pdf-to-html.
@mgufrone , From where to read this part?
`include 'vendor/autoload.php';
use Gufy\PdfToHtml\Config;
// change pdftohtml bin location
Config::set('pdftohtml.bin', 'D:/wamp/www/pdftohtml/poppler/poppler/bin/pdftohtml.exe');
// change pdfinfo bin location
Config::set('pdfinfo.bin', 'D:/wamp/www/pdftohtml/poppler/bin/pdfinfo.exe');
// initiate
$pdf = new Gufy\PdfToHtml\Pdf('file.pdf');
// convert to html and return it as Dom Object
$html = $pdf->html();`
i have set above location for poppler
from pdf-to-html.
Okay, I will take a look into it. I will inform you what I found
from pdf-to-html.
I'm really struggling with the error @garbus points out:
But I started to getting warnings with getting html output like "(...)test-1.html: failed to open stream: No such file or directory" [src/Html.php:36]
Weird thing is, that the displayed path exists! When copy-pasting it to the explorer I can see the HTML file. Sample path is: C:_MY_FILES\PROJECTS\eclipse_workspace\htdocs\My_Project\vendor\gufy\pdftohtml-php\src/../output/57ea99fab3250/test-1.html
When opened it manually I can see the file content as "something failed". Probably two new problems. One with path somehow, second that parsed html is not generated. No power to continue this fight. :-|
My error.log:
[23-Apr-2018 15:58:19 UTC] PHP Warning: file_get_contents(/home/researy8/public_html/output/test(2)-1.html): failed to open stream: No such file or directory in /home/researy8/public_html/vendor/gufy/pdftohtml-php/src/Html.php on line 41 [23-Apr-2018 15:58:19 UTC] PHP Warning: DOMDocument::loadHTML(): Empty string supplied as input in /home/researy8/public_html/vendor/gufy/pdftohtml-php/src/Html.php on line 45
Unlike him my server is Linux based. Please help.
from pdf-to-html.
I found the issue.
sudo yum install poppler-utils
That installs an old version (0.12.4) which does not have pdftohtml command options like "-s" and "-fmt".
Go to this page https://medium.com/@jakebathman/building-poppler-utils-for-centos-6-5-really-e52eccffc6ae to guide you on how to get a later version of poppler-utils. I installed https://poppler.freedesktop.org/poppler-0.22.5.tar.gz instead of 0.13.4 as instructed.
All the best!
from pdf-to-html.
Related Issues (20)
- taking extra spaces in html
- How to handle special chars?
- Setting the generate image path HOT 2
- How can i change image src path? HOT 1
- Notice: Undefined index: pages HOT 5
- Why is this issue?
- Landscape document HOT 1
- Error exception when converting pdf to html file on window machine?
- Treatment of HTML generated file
- Ubuntu pdftohtml and pdfinfo not present.
- pdftohtml conversion only converting the 1st page or even less than that. HOT 1
- vendor/gufy/pdftohtml-php must have write access HOT 1
- It extension is work on the dedicated linux server?
- mb_eregi_replace() Error HOT 1
- HTML Output Class meaning
- PHP 7.1 + Compatibility HOT 5
- Class 'Gufy\PdfToHtml\Config' not found
- The text of PDF is being rendered as image HOT 2
- Сount(): Parameter must be an array or an object that implements Countable HOT 6
- No styles for classes like ft00, ft01 etc.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdf-to-html.