Comments (15)
Did you downloaded the phantomjs binaries and put it on the right folder?
from h2p.
Yes, I downloaded, extracted, and placed in the h2p/bin/linus-x86_64 folder.
At first, i was getting an error about the binaries not being found, but I changed its permission to 777 and it gave the new error.
from h2p.
It doesn't look like PHP executed phantom at all. Can you try this code below and tell me its output?
echo shell_exec('bin/linux-x86_64/phantomjs -v');
from h2p.
All the page says is:
1.9.7
from h2p.
That's expected. Can you do a chmod +x
in the bin/converter.js
file and try again?
Edit: No, wait, this won't work either.
from h2p.
No change, exact same error when running the original php script
from h2p.
The script is creating a pdf file in the folder, but the pdf is corrupt (0kb). It's also blank when I open in a text editor.
In case that helps at all.
from h2p.
Does not work with simple example, phantomjs 1.9.7:
PHP Fatal error: Uncaught exception 'H2P\Exception' with message 'Error while executing PhantomJS: "SyntaxError: Unable to parse JSON string"' in \vendor\kriansa\h2p\src\H2P\Converter\PhantomJS.php:283
Stack trace:
#0 C:\Users\Tomas\PhpstormProjects\zibintas_naudoti\vendor\kriansa\h2p\src\H2P\Converter\ConverterAbstract.php(136): H2P\Converter\PhantomJS->transform(Object(H2P\Request), 'page.pdf')
#1 C:\Users\Tomas\PhpstormProjects\zibintas_naudoti\vendor\convert.php(14): H2P\Converter\ConverterAbstract->convert('http://www.goog...', 'page.pdf')
#2 {main}
thrown in \vendor\kriansa\h2p\src\H2P\Converter\PhantomJS.php on line 283
Fatal error: Uncaught exception 'H2P\Exception' with message 'Error while executing PhantomJS: "SyntaxError: Unable to parse JSON string"' in \vendor\kriansa\h2p\src\H2P\Converter\PhantomJS.php on line 283
H2P\Exception: Error while executing PhantomJS: "SyntaxError: Unable to parse JSON string" in \vendor\kriansa\h2p\src\H2P\Converter\PhantomJS.php on line 283
from h2p.
That could be because the page that phantomjs is rendering carries on that error. I'm planning to create a PR with an updated version of the converter. However if you want to make a try, I have a fork of it in my repos.
from h2p.
@topazas Have you tried another html file? Maybe it's because you had a JS error as described by @ilpaijin.
from h2p.
Hello! I have the same error of @topazas , I tried use the simple example.
from h2p.
I'm having the same problem as @topazas and @gustavowiller. I've tried the simple example and I'm getting nothing back from the processor. I'm running this on a mac (yosemite). I have the binary in place, I tried running chmod +x on the file and I'm just getting nothing back from the shell execution. Same line number - the $result
is blank.
EDIT: I get this when doing a convert on google.com and also when doing a simple HTML conversion $input = new \H2P\TempFile("<b>test</b>", 'html');
EDIT AGAIN: when I try to run the shell commands directly in terminal I get "Killed: 9". The zero-byte file shows up.
from h2p.
E aí @kriansa tranquilo?
Kra, estou com um probleminha, baixei seus 2 repositórios - openboleto e H2P - fazendo testes no Windows (8.1) tive a seguinte mensagem de erro - Error while executing PhantomJS: "SyntaxError: JSON Parse error: Expected '}'"
Baixei o phantomjs.exe e coloquei no diretório win32 conforme orientações da documentação e nada.
Estou usando CakePHP para minha aplicação.
Uma coisa estranha que reparei, é que ele diz não ter permissão para escrever o arquivo no diretório temporário "The destination file is not writable!" no ConverterAbstract.php na linha 132
Já tentei todos os exemplos e nada.
Se tiver um tempo para uma ajuda... obrigado man.
from h2p.
Hmmm same error here on OSX Yosemite. Anybody got a working solution?
Seems like the temp file can't be created. Will try tonight on linux machine....
edit hmmm seems like there aren't any binary packages for linux yet :(
from h2p.
Well, i got it running using on a linux server. Unfortunately you have to compile your own binary for linux if you want to use PhantomJS versions > 2.0
1.9.8 (x64) can be downloaded here: https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
More info: https://gist.github.com/julionc/7476620
from h2p.
Related Issues (13)
- Error while executing PhantomJS: Unable to access the URI! HOT 7
- Handling with javascript errors HOT 2
- Parse Error in windows HOT 12
- Erro na execução de um dos exemplos. HOT 3
- Class not found HOT 2
- Erro geração do pdf HOT 4
- Generating corrupted 0KB PDF HOT 9
- Seleção de DPI
- WriteHTML to PDF file has quality loss on images
- Temp file conversion does not work. HOT 5
- Support for more configuration parameters HOT 1
- Headers and footers HOT 1
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 h2p.