Closed anouarabdsslm closed 4 years ago
I would try checking two things:
Hope it helps!
I'm getting the exact same error. I switched between both versions and permissions are set to 777. More help would be appreciated!
Also keep in mind that these are Debian Wheezy (7.8) binaries. If you are using Mac OS X or Windows, these binaries won't work.
@gdevlugt thanks for the hint
So what to do on a Mac OS X?
how to get it to work on mac os x?
@mpixelz @peyman-mohamadpour use the same as linux
got it working.. but how do i set if else on snappy config file? for instance.. im working on mac osx but have deployed the system on linux system.. php_os return Darwin for mac and Linux for server.. the binary paths are different for each of them.. how can i make it switch automatically based on the os?
I'd use an env variable, set a new one in your .env
file
that works on the local but base_path(''); does not work on env file on server :(
edit: working using full hard coded path in env thanks for the help :)
@mpixelz Could you please show us what you have done in snappy config file and env file. Thanks
I couldn't change the permissions on the server to executable, so it was working on localhost but not on the web server. I changed to barryvdh/laravel-dompdf and this works great as doesn't use a binary file, the package is complete in itself.
if you use macOS ,
first of all go to http://wkhtmltopdf.org/downloads.html , then download the proper package according to your os . after installing the package do the followings :
in the config/snappy.php file , write the name of the {bin file} which has been installed in /usr/local/bin , which in my case is wkhtmltopdf :
'binary' => '/usr/local/bin/{bin file}'
so :
'binary' => '/usr/local/bin/wkhtmltopdf'
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/KnpLabs/snappy instead. When having doubts, please try to reproduce the issue with just snappy. If you believe this is an actual issue with the latest version of laravel-snappy, please reply to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
Totally ran into this, i did the above suggestions for installing on MacOS, by using brew cask install wkhtmltopdf
and my error changed to the below message.
So it seemed to at least make it farther, and then failed ¯_(ツ)_/¯
The exit status code '1' says something went wrong: stderr: "Loading pages (1/6) [> ] 0% [======> ] 10% Warning: Blocked access to file Warning: Blocked access to file [=========> ] 15% Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown [============================================================] 100% Counting pages (2/6) [============================================================] Object 1 of 1 Resolving links (4/6) [============================================================] Object 1 of 1 Loading headers and footers (5/6) Printing pages (6/6) [> ] Preparing [============================================================] Page 1 of 1 Done Exit with code 1 due to network error: ProtocolUnknownError " stdout: "" command: /usr/local/bin/wkhtmltopdf --lowquality '/var/tmp/knp_snappy5f2c54a8bd43b5.68847902.html' '/var/tmp/knp_snappy5f2c54a8bd59d5.18404886.pdf'.
Hi barry, when I hit my end point I get this exception:
My config file:
My route end point: