I'm curious..🤔 How do you actually install SnapPDF?

Hi guys.

Well… It is pretty much as the subject headliine says… :+1:

1.) How do you actually install SnapPDF on your own server?

The documentation here https://invoiceninja.github.io/docs/self-host-troubleshooting/#pdf-conversion-issues doesn’t tell much about it, so If I am correct there isn’t any complete guide on how to actually do it on Invoice Ninja. just bit and cookie trails here and there all over the forum and the documentation itself.

I did found this forum thread that reveals that you need to install some server dependencies on your machine:

sudo apt install libnss3-dev libatk1.0-0 libatk-bridge2.0-0 libcups2 libgbm1 libpangocairo-1.0-0 libgtk-3-0

I’m not sure if it is required for everyone and how it supposed to be configured so it would be nice I suppose not only for me but for everyone here using Invoice Ninja to get this finally clarified.

2.) Also is there any good reason or cons/pros/advantages to using SnapPDF over Phantomjs to generate PDF files?

So back to my original question like I said: :smirk:
How do you actually install SnapPDF on Invoice Ninja server the proper way?

Thanks in advance.

Hi,

@david can you please advise for #1

For #2 the main advantages are that it’s faster and your data doesn’t need to leave your server to generate the PDF.

from the root of the invoice ninja project, run

./vendor/bin/snappdf download

Snappdf will download the correct binary for your platform. One thing to note, you’ll want to execute the download as the web user to ensure the permissions are correct.

so the full command may look like this for ubuntu:

sudo -u www-data ./vendor/bin/snappdf download

Thanks guys.

Do you also need to install all those dependency files I mentioned above?

Yes, these are subsystem requirements for chrome itself to run.

1 Like

Getting these errors:

No package libnss3-dev available.
No package libatk1.0-0 available.
No package libatk-bridge2.0-0 available.
No package libcups2 available.
No package libgbm1 available.
No package libpangocairo-1.0-0 available.
No package libgtk-3-0 available.

What repository do I need?

Running CentOS 7

Installing SnapPDF can be better documented :slight_smile:. Finally what I did for my Debian 12 installated v5.10.31 was:

  • edit “.env” file to have PDF_GENERATOR=snappdf
  • inside folder /var/www/invoiceninja and as user www-data: ./vendor/bin/snappdf download
  • After that some packages need to be installed in addition:
    sudo apt install libasound2 libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libxcomposite1 libxrandr2 libgbm1 libpangocairo-1.0-0 libgtk-3-0
    sudo apt install libnss3-dev libatk1.0-0 libatk-bridge2.0-0 libcups2 libgbm1 libpangocairo-1.0-0 libgtk-3-0
  • Then I restarted my apache webserver and it worked
3 Likes

Apologies for engaging on an old thread but how can this be done in a docker environment?

Or with Softcalous Installation…

That’s risky I’d think. That installation script could potentially mess things up on some servers depending on the setup…

Why do you say it is risky?

Because these installation scripts sometimes tend to overwrite stuff that they should not overwrite and also they are not always production ready and safe/secure.

So after you have run the Softcalous installation script you need to manually harden your server security and that webapp you just installed.

Personally I never use that Softcalous because it just better and easier in the end so just do it right from the start and manualy install the software/webapp

1 Like