barryvdh / laravel-snappy

Laravel Snappy PDF
MIT License
2.59k stars 289 forks source link

Unable to Generate PDF on M1 Mac #484

Open zachweix opened 1 year ago

zachweix commented 1 year ago

I'm not sure if this is the right place or "wkhtmltopdf", but when I try to generate a PDF on an M1 Max Mac Studio, using docker, I get the following error:

stderr: "qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
"
stdout: ""
command: /git/lyb/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality --enable-local-file-access '/tmp/knp_snappy6351549bf0a344.22909548.html' '/tmp/knp_snappy6351549bf0a9e9.21440911.pdf'.

After doing research, I realized it is that I am on a machine that is using native ARM ubuntu and it expects to be running x86/x64 intel. When I run with the some configuration on an intel linux machine everything is working. Is there something I need to do or is this a bug? It looks like the feature of creating the PDF was never implemented properly on ARM powered machines

VictoRD11 commented 1 year ago

Hi @zachweix, We use wkhtmltopdf on m1 in docker and we have no problem.

Our dockerfile: https://pastebin.com/akSfz4bf

I hope this will help you 💙💛

asieduernest12 commented 1 year ago

@VictoRD11 i have this line in laravel right and it is sending content-type text/html no matter what i try return response()->streamDownload(function(){ echo $somepdfcontent;}, ["Content-Type"=> "application/pdf"]);

stale[bot] commented 1 year ago

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.

kkallasm commented 11 months ago

The same problem still exist. I'm using Macbook M2. You can go around by using "platform: linux/x86_64" in your docker-compose.yml file but it will get really slow then and it's not usable.

VictoRD11 commented 11 months ago

Can you show us your docker file?