Coder Social home page Coder Social logo

Error Executing a Test PDF about h2p HOT 15 OPEN

bdowd625 avatar bdowd625 commented on August 19, 2024
Error Executing a Test PDF

from h2p.

Comments (15)

kriansa avatar kriansa commented on August 19, 2024

Did you downloaded the phantomjs binaries and put it on the right folder?

from h2p.

bdowd625 avatar bdowd625 commented on August 19, 2024

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.

kriansa avatar kriansa commented on August 19, 2024

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.

bdowd625 avatar bdowd625 commented on August 19, 2024

All the page says is:

1.9.7

from h2p.

kriansa avatar kriansa commented on August 19, 2024

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.

bdowd625 avatar bdowd625 commented on August 19, 2024

No change, exact same error when running the original php script

from h2p.

bdowd625 avatar bdowd625 commented on August 19, 2024

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.

tmsnvd avatar tmsnvd commented on August 19, 2024

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.

ilpaijin avatar ilpaijin commented on August 19, 2024

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.

kriansa avatar kriansa commented on August 19, 2024

@topazas Have you tried another html file? Maybe it's because you had a JS error as described by @ilpaijin.

from h2p.

gustavowiller avatar gustavowiller commented on August 19, 2024

Hello! I have the same error of @topazas , I tried use the simple example.

from h2p.

sparkweb avatar sparkweb commented on August 19, 2024

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.
shell_command

from h2p.

gildonei avatar gildonei commented on August 19, 2024

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.

Bechrissed avatar Bechrissed commented on August 19, 2024

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.

Bechrissed avatar Bechrissed commented on August 19, 2024

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)

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.