laravel-snappy: Problem to download/save PDF with assets

Hi guys,

I got a problem when I want to download a PDF from view.

When I remove the assets its works fine, but when I use them I got this error… he exit status code '1' says something went wrong: stderr: "Loading pages (1/6) [> ] 0% [======> ] 10% QSslSocket: cannot resolve CRYPTO_num_locks QSslSocket: cannot resolve CRYPTO_set_id_callback QSslSocket: cannot resolve CRYPTO_set_locking_callback QSslSocket: cannot resolve sk_free QSslSocket: cannot resolve sk_num QSslSocket: cannot resolve sk_pop_free QSslSocket: cannot resolve sk_value QSslSocket: cannot resolve SSL_library_init QSslSocket: cannot resolve SSL_load_error_strings QSslSocket: cannot resolve SSLv3_client_method QSslSocket: cannot resolve SSLv23_client_method QSslSocket: cannot resolve SSLv3_server_method QSslSocket: cannot resolve SSLv23_server_method QSslSocket: cannot resolve X509_STORE_CTX_get_chain QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf QSslSocket: cannot resolve SSLeay QSslSocket: cannot call unresolved function CRYPTO_num_locks QSslSocket: cannot call unresolved function CRYPTO_set_id_callback QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback QSslSocket: cannot call unresolved function SSL_library_init QSslSocket: cannot call unresolved function SSLv23_client_method QSslSocket: cannot call unresolved function sk_num [==========> ] 18% [===============> ] 25% [==================> ] 31% [======================> ] 38% [=========================> ] 43% QSslSocket: cannot call unresolved function SSLv23_client_method QSslSocket: cannot call unresolved function SSL_library_init QSslSocket: cannot call unresolved function SSLv23_client_method QSslSocket: cannot call unresolved function SSL_library_init [============================================================] 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 2 [============================================================] Page 2 of 2 Done Exit with code 1 due to network error: UnknownNetworkError QSslSocket: cannot call unresolved function CRYPTO_num_locks QSslSocket: cannot call unresolved function CRYPTO_set_id_callback QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback " stdout: "" command: /usr/local/bin/wkhtmltopdf-amd64 --lowquality --page-size 'letter' --enable-javascript --javascript-delay '4000' --viewport-size '1366x1024' '/tmp/knp_snappy5991c1b4cb1a41.29456871.html' '/tmp/knp_snappy5991c1b4cb2446.10870121.pdf'.

I have two assets (css and js). <link rel="stylesheet" href="{{ url('/').mix('css/pdf.css') }}"> and <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script> The view render without problem.

Can you help me pls, this problem repeats in Homestead (Windows) and Forge (Ubuntu Server).

Regards.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 23

Most upvoted comments

Worked for me: apt-get install libssl1.0-dev

Remove “https” from all the resources <script src="http://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script>

This issue occurs still on Ubuntu 20.04.1 (homestead latest) there is no longer a candidate for libssl1.0-dev

I’m still trying to resolve this myself, but not getting very far 😦

My fix:

Installed wkhtmltopdf on my server sudo apt update sudo apt install wkhtmltopdf

After successful installation, I find the wkhtmltopdf and create a symlink find / -name wkhtmltopdf ln -s /usr/bin/wkhtmltopdf /usr/local/bin/whtmltopdf-amd64

For me, this is the fix for my encountered errors such as ‘ssl resources not loading, error 127, libssl error, and many more’ I think it is case to case basis depends on the environment and versions of platforms. Thanks.

My Platform Details:

  • Ubuntu 22.04
  • Laravel Forge on DigitalOcean
  • Laravel 9
  • PHP 8.1

I am running Ubuntu I did this: My fix:

then, change the config/snappy.php like this: ‘binary’ => ‘wkhtmltopdf’,

My fix:

Installed wkhtmltopdf on my server sudo apt update sudo apt install wkhtmltopdf

After successful installation, I find the wkhtmltopdf and create a symlink find / -name wkhtmltopdf ln -s /usr/bin/wkhtmltopdf /usr/local/bin/whtmltopdf-amd64

For me, this is the fix for my encountered errors such as ‘ssl resources not loading, error 127, libssl error, and many more’ I think it is case to case basis depends on the environment and versions of platforms. Thanks.

My Platform Details:

* Ubuntu 22.04

* Laravel Forge on DigitalOcean

* Laravel 9

* PHP 8.1

Then then, change the config/snappy.php like this: ‘binary’ => ‘wkhtmltopdf’,

Make sure your view/html page without error (missing assets such as image, font, css, js or incorrect tag). Fix it first before load into snappy pdf.

I fixed the problem in Ubuntu 20 by installing wkhtmltopdf manually, check this article for instructions https://computingforgeeks.com/install-wkhtmltopdf-on-ubuntu-debian-linux/