SnapPDF on CentOS8

Had a tough time getting SnapPDF Generation 100% on CentOS 8 and hoping this may help someone running into the same issues because this is what got it working well for me.

I got close to getting snappdf working following the official instructions but a few things were strange, like in the I.N client portal the invoices were mirrored (even though in the I.N app doing a preview they were fine)

This is what got PDF Generation 100% for me on CentOS 8.3:

sudo dnf install -y atk aspell cups-libs libdrm libXcomposite libXdamage libXrandr libgbm libnss3.so libnssutil3.so libsmime3.so libnspr4.so libXext.so.6 libXfixes.so.3 libcairo.so.2 libgdk_pixbuf-2.0.so.0 alsa-lib libxshmfence gtk3

change directory to path of your I.N install

sudo ./vendor/bin/snappdf download

sudo -u nginx php artisan optimize


Background:

After you run ‘sudo ./vendor/bin/snappdf download’ from I.N install directory, run ldd to find missing dependencies:
‘sudo ldd ./vendor/beganovich/snappdf/versions/839879-Linux_x64/chrome-linux/chrome | grep not’ (or whatever version was downloaded, this was the version for me at time of this writing)

I get that your suppose to be able to run composer to install missing libraries ‘composer require beganovich/snappdf’. But this didn’t actually work for me. It said it worked. However comparing before and after using ldd it didn’t resolve any of the missing dependencies and they were still ‘not found’

Trying to DNF install the missing library names mentioned using ldd did not work. Going to https://pkgs.org/ and searching for the missing library names, finding the x86_64 rpm for cent os 8 and scrolling down to the ‘Install howto’ showed me the right package names that worked for me.

1 Like

Hey there, I’d just like to add this is documented now:

I think one dependency missing from that list for centos still. When i run:
sudo ldd /var/www/html/ninja/vendor/beganovich/snappdf/versions/851198-Linux_x64/chrome-linux/chrome | grep not

Returns: “libxshmfence.so.1 => not found”

adding libxshmfence dependency resolved.

Awesome, thanks for such finding. Do you mind sending the pull request to the snappdf repo? Thanks!