Creation of PDF fails

Hi,
I am currently running version v5.3.27-C62 dockerized.
After creating 3 invoices the pdf generation stopped working. Neither the preview nor the download is working.
The error message I receive is the following:
“500: Internal Server Error There was an error generating the PDF with Phantom JS”

What I’ve done so far:

  • docker-compose down / pull / up to update
  • looked up the internet - only found the idea of a new installation to resolve this issue (I really don’t want to)
  • changing PHANTOMJS_PDF_GENERATION=false to true and again back to false

I would really appreciate any help!

Hi,

If you’re using the anonymous key it may help to create an account.

hmm this doesn’t seem to solve the issue or am I doing something wrong, this is my env file:
APP_URL=blurred
APP_KEY=blurred
REQUIRE_HTTPS=true
APP_DEBUG=false
MULTI_DB_ENABLED=false
DB_HOST1=db
DB_PORT1=3306
DB_USERNAME1=ninja
DB_PASSWORD1=blurred
DB_DATABASE1=ninja
MYSQL_ROOT_PASSWORD=blurred
MYSQL_USER=ninja
MYSQL_PASSWORD=blurred
MYSQL_DATABASE=blurred

#this is a system variable please do not remove
IS_DOCKER=true

PHANTOMJS_PDF_GENERATION=true
PHANTOMJS_CLOUD_KEY=‘valid-blurred-key’
#V4 env vars
DB_STRICT=false
DB_HOST=db
DB_DATABASE=ninja
DB_USERNAME=ninja
DB_PASSWORD=blurred
APP_CIPHER=AES-256-CBC

Do you have any idea? The docker logs do not seem to write anything about this error.

Maybe you need to add PDF_GENERATOR=phantom

https://invoiceninja.github.io/docs/env-variables/

It seems like the docker containers do ignore the changes I do in my env file.
If I change the the generator to PDF_GENERATOR=hosted_ninja it stills shows an error of PhantomJs - souldn’t there be at least a different error?

You may need to run php artisan optimize after changing the file

I am sorry this does not change anything - might it be possible that the docker version isn’t as good as the “normal” installation?

Ok, now I really believe to have found the issue. I have never used the mail function before but as it is required to export all data (because a url will be sent to you) I wanted to set it up.
Result: Nothing - invoice ninja does not even try to login on my mailserver (I don’t see anything in the logs).
As a result I assume that the env variables of my env file do not get read or intepreted.
Calling php artisan optimize results with success but no changes can be seen.

EDIT: OK it seems to work after tinkering with different kind of quotes…

PDF generation still does not work

If you’re using docker I think it should use SnapPDF.

@david @ben any ideas?

okay - do you have any documentation how to set snappdf up wtih docker - I can’t find anything right now

EDIT: I just found out it is already in the docker-image:

Snappdf is also the default PDF engine in our Docker image, so if you prefer a very simple installation please consider our Docker setup as it is very fast to get going!

Although I have declared

PDF_GENERATOR=snappdf

It still shows an error that something with phantomjs went wrong

Today I tried again to create an invoice and it worked (only my companys’ logo was print as if the image could not be found - but that’s another topic).
I believe it only worked because it’s a new day and as a result a I have new free PhantomJs Cloud credits. So this shows me that the settings of the env file which configure the pdf generator or the PhantomJs Cloud Key do not get applied correctly in the application.

Do you have any idea what I could do or what the problem is?
I really want to avoid reinstalling invoice ninja…

You can check if the changes in the .env file are taking effect using the health check option in the app’s about dialog.

If you aren’t able to run the optimize command you can try loading /update?secret=

Thank you very much!!!
It seems now to be working correctly.

Do you have any idea why snappdf (which is now in use) cannot print the logo on my pdfs? I have already deleted my company logo and uploaded it again but this made no difference!

It may help to set LOCAL_DOWNLOAD=true in the .env file

https://invoiceninja.github.io/docs/env-variables/