Snappdf can't get working

I’ve been pulling my hair out trying to get snappdf to work. I’m sure i’m just missing something very basic but i’ve gone through all the instructions and read all the forum issues but i just can’t seem to get it to work.

I’ve followed the instructions on installing snappdf:

GitHub - beganovich/snappdf: Convert webpages or HTML into the PDF file using Chromium-powered browsers.

added the PDF_GENERATOR=snappdf in the .env

run artisan optimize

running it manually worked ok under the local account so it seems to be a permissions issue with www-data?

when i run sudo -u www-data ./vendor/bin/snappdf download it says permission denied but when i check

@Ninja-5:~$ ls -l ./vendor/bin/
total 4
-rwxrwxr-x 1 xxxxxx xxxxxxx 3212 May 5 12:01 snappdf

according to this www-data should be able to execute?

just saw this is the laravel.log

[2024-05-05 04:32:19] production.ERROR: Browser binary not found. Make sure you download it or set using setChromiumPath(). {“userId”:1,“exception”:"[object] (Beganovich\Snappdf\Exception\Binary>[stacktrace]

I’m sure it’s something very simple i’m missing so any help would be appreciated.

Ubuntu 22.04.4 LTS
InvoiceNinja 5.8.52
PHP 8.1.28

UPDATE —

i got chromium installed but now i get this in the logs.
production.ERROR: The command “‘/snap/bin/chromium’ ‘–headless’ ‘–disable-gpu’ ‘–disable-translate’ … ‘–print-to-pdf=/tmp/pdf_oqRgo4.pdf’ ‘/tmp/html_9Q6OG0.html’” failed

so still not working.

Hi,

Maybe the info here will help:

i’ve added the following to the env file but still get the same error.

PDF_GENERATOR=snappdf
SNAPPDF_CHROMIUM_PATH=/snap/bin/chromium

production.ERROR: The command “‘/snap/bin/chromium’ ‘–headless’ ‘–disable-gpu’ ‘–disable-translate’ … ‘–print-to-pdf=/tmp/pdf_oqRgo4.pdf’ ‘/tmp/html_9Q6OG0.html’” failed.

when i run the command manually its works.

./vendor/bin/snappdf convert --html “

Hello world

” save.pdf
Success! PDF saved at save.pdf

at a loss why it won’t execute within Ninja.

@david do you have any suggestions?

i started fresh using version 5.9.5 and using the hosted option is now working for me so don’t need the snappdf anymore.

thank you.

Glad to hear it, thanks for the update!