PDF is attached, but doesn't open

I installed invoiceninja on a Debian 10 computer and configured it to include the incoice as an attachment when sending email to clients.

  • I installed PhantomJS (apt install -y phantomjs)
  • Added company information under Settings > Company Details
  • Added “PHANTOMJS_BIN_PATH=/usr/bin/phantomjs” in “/var/www/html/invoiceninja/.env”
  • I have enabled “Attach PDF” in Advanced Settings > Email Settings
  • I receive the email with the attached pdf
  • But when I try to open it I get this message

3

Any idea what could be causing this issue?
Thanks

Hey,

Thanks for reaching us. Unfortunately, we don’t support the usage of phantomjs locally. If you really want to use phantomjs, you’ll have to create a cloud account at https://phantomjscloud.com.

By the way, we recently shipped a new way of generating PDFs using local Chromium, which is 2-3x faster than phantomjs, so consider that as well.

Thanks.

Can you point me to documentation on how to implement the Chromium method? I’ve search https://invoice-system.readthedocs.io/en/latest/ but I could not find anything Chromium related. Thanks

Yes, sure! Our docs are still work-in-progress, so that’s understandable.

Can I know how you installed Invoice Ninja on your machine? Was it prebuilt ZIP or your cloned repository manually?

I cloned the repository manually.

First, make sure you install all required dependencies for headless Chromium. You can find them here:

After that run following command in the invoiceninja5 folder:

./vendor/bin/snappdf download

… and finally run:

php artisan optimize

And that should be it.

So I installed nodejs
nodejs
and npm
npm
and puppeteer

But snappdf does not seem to exist in /var/www/html/invoiceninja/vendor/bin

So this command is not working
ssnnaapp

Also, you mention invoiceninja5 folder, but when I cloned the repository, version 4.5.24 was downloaded.

These are the commands I used to download and install invoiceninja

cd /var/www/html
git clone https://github.com/invoiceninja/invoiceninja.git
cd /var/www/html/invoiceninja
composer install

This is the whole script

Hey there!

We also offer releases thru prebuilt zip file, if that’s an option for you. They’re available at: https://github.com/invoiceninja/invoiceninja/releases/

Of course, if you opt-in for manual way, after cloning make sure you checkout into one of two branches:

git checkout v5-develop

or

git checkout v5-stable

Thanks!