Company Logo not display within invoice

Thanks for sharing your solution!

@david & @ben should we consider making this a .env option?

i think we can merge that as is.

3 Likes

Hello @david, Hello @ben,

I recently discovered the same issue as (at)geoff with the latest v5.1.1-C41.
The PDF/Logo tests on a Raspberry PI with Ubuntu 20.04.2 LTS Server NGINX worked fine when using the this nginx config given here serving only unencrypted port 80: https://invoiceninja.github.io/docs/self-host/

When setting up a snakeoil-self-certificated server the Logos disappear in the PDF.

I use ungoogled-chromiun from opensuse-repositories which is at version 84 and tested different flags:

sudo nano /etc/chromium.d/default-flags

Invoice Ninja Snapppdf-Settings

export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --allow-file-access-from-files"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --allow-http-background-page"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --allow-http-screen-capture"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --allow-insecure-localhost"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --allow-external-pages"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --disable-namespace-sandbox"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --disable-setuid-sandbox"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --disable-web-security"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --dns-log-details"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --enable-crash-reporter"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --host=https://invoicninja.local"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --ignore-urlfetcher-cert-requests"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --unsafely-treat-insecure-origin-as-secure=http://invoiceninja.local"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --disable-machine-cert-request"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --ignore-urlfetcher-cert-requests"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --user-data-dir=/srv/chromium"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --enable-experimental-cookie-features"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --enable-logging=stderr --v=1"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --no-sandbox"
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --log-level=1"

Switching the domain from invoiceninja.local to invoiceninja.test did not change anything.

It seems, that the Logos don’t get passed to the headless chromium due to certification-restrictions within chromium called from snappdf. I can also call my company-logo via the url at /storage/…/….png.

The snap-chromium I did not manage to get it work, as I am not familiar with snap interfaces e.g.

Do you have any idea, how to get the logos in the PDF displayed? I plan to have a local Raspberry PI installation without public access and but at least self-encrypted HTTPS.

I really appreciate your great work on this useful piece of software! Thank You!

hi @cdahinten the issue will most likely be deep within chromium, i’ve seen similar issues pop up with self signed ssl’s and also local domains that are not .test being denied completely by chromium.

Hi @david, do you think there could be an option in the company-logo-dialogue to have the choice between importing a logo or give a logo-URL from outside (e.g. https-homepage, social-media-profile)?

Hello @david, maybe you can help me investigate the problem a bit further: When creating a new company the Invoice Ninja logo (I guess this one from public/images/logo.png) shows up correctly in the PDF until it gets replaced by a custom logo. The created-by-invoiceninja.jpg does not show off in the PDF in any case. Could it be a mime/type issue in ngnix or maybee a filename-size issue – or path mismatch in the snappdf query. As I am not a developer nor admin I have limited skills in fixing that out. I’d believe in an chromium issue if the public/images/logo.png would not show off in a fresh company.

Are there any logs, which I could look up. laravel.log does indicate normal operation.
nginx/access.log shows:

192.168.0.85 - - [05/Feb/2021:18:13:11 +0100] “GET /storage/Xk5RspJX2vCuMFWLquqyPkS3BUPOakcHVNuslN8tftKZobDZzeqK11aB0ZzAlovG/KLFzjjEoqo5CqHQ1HjcvMi3MJ53VJYKEvS7z7zz4.png HTTP/1.1” 200 21243 “-” “Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/84.0.4147.135 Safari/537.36”
192.168.0.85 - - [05/Feb/2021:18:13:11 +0100] “GET /images/created-by-invoiceninja-new.png HTTP/1.1” 200 25088 “-” “Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/84.0.4147.135 Safari/537.36”
192.168.0.101 - - [05/Feb/2021:18:13:14 +0100] “GET /client/invoice/fSaPsNI9IrqazSSpNkurQ5kblUPheLme7ZDegbY1kTOehBNwsbrwZ4Gm8jci0mSt/download_pdf HTTP/1.1” 200 245874 “http://invoiceninja/” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:85.0) Gecko/20100101 Firefox/85.0”

Seems OK to me, what do you think?

can you access the logo directly in a browser using the following URL

https://your.url.com/public/storage/Xk5RspJX2vCuMFWLquqyPkS3BUPOakcHVNuslN8tftKZobDZzeqK11aB0ZzAlovG/KLFzjjEoqo5CqHQ1HjcvMi3MJ53VJYKEvS7z7zz4.png

The most likely reason it is not displaying on your PDF, is that your server cannot resolve the URL

Hey there, sorry to interrupt, have you tried adding --ignore-certificate-errors in the launch options?

Hello @ben, Hello @david,

coincidentally I was right about to post this solution you recommended:

– Set general-flags for ungoogled-chromium from opensuse repositories (version 84+)
sudo nano /etc/chromium.d/default-flags

– Add e.g. at the end:

Invoice Ninja Localhost-Setup Snapppdf-Settings

export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --ignore-certificate-errors"

This would be nice to have added in the Ubuntu/Centos installation guides.

This also prevents my setup to run on a .test domain. I consider, that .internal, .intranet or .home are more trustworthy, self-explanatory and convenient!

Thank you for your support! I will evaluate the app and I am sure that even license key operation will work now succesful, due to the fact that the “Invoice Nina created with …” badge was not loaded too.

Another PDF related question: Are these variables set in my .env operational?

SNAPPDF_EXECUTABLE_PATH=/usr/bin/chromium
SNAPPDF_SKIP_DOWNLOAD=true

I have set them, but at the recent updates snappdf pulled a new version of chromium. My test installation does not access my local chromium. I symlinked chromium into the vendor/snappdf which is more of a “hack” than a good solution. Do you have an idea, why?

1 Like

Thanks for the awesome feedback!

It’d be awesome if you can pull request or just suggest your changes on the package repository here: https://github.com/beganovich/snappdf

SNAPPDF_EXECUTABLE_PATH=/usr/bin/chromium
SNAPPDF_SKIP_DOWNLOAD=true

Variables should be exported globally (just like CHROMIUM_FLAGS) for now, but I plan to add them into Invoice Ninja.

Just for info, i had the same issue concerning the missing logo in quotes and invoices with my docker + nginx reverse proxy setup. The exposed nginx port is 80 (no ssl cert on docker)
The problem was coming from the /etc/hosts file in invoiceninja-app container.
Reading the docker setup doc : “Note for people running the container locally on their PC”, i understood i needed to add an extra host entry so the app container could resolve the APP_URL using the LAN IP of the reverse proxy.
That was wrong for my setup, changing the LAN IP to the docker network IP of my proxy did the trick.

To be more clear : in /etc/hosts of invoiceninja-app container

Not working setup (no logo in quotes and invoices)
<REVERSE PROXY LAN IP> <APP_URL>
192.168.1.33 invoice.my.domain

Working setup
<REVERSE PROXY DOCKER IP> <APP_URL>
178.18.0.2 invoice.my.domain

To check, login to your invoice-app container and verify that it can ping your APP_URL.
sudo docker exec -it --user root invoiceninja-app sh
ping invoice.my.domain

1 Like

hello lolo6tm,
can you please tell me what is your 178.18.0.2 ip address?

I’ve been battling this for 48 hours and cant get logo to be displayed.

the IP of my host, hosting docker is 192.168.11.5
APP_URL=http://in5.test:8003

both myhost and app container can ping the host name, please see below

/var/www/app # ping in5.test
PING in5.test (192.168.11.5): 56 data bytes
64 bytes from 192.168.11.5: seq=0 ttl=64 time=0.056 ms
64 bytes from 192.168.11.5: seq=1 ttl=64 time=0.074 ms
64 bytes from 192.168.11.5: seq=2 ttl=64 time=0.076 ms

any idea how to fix this?
I am running the latest code using docker compose.

when i try to access i get the page can not be displayed
http://192.168.11.5/public/storage/ugy1dpuul97nawajvfwkgzvqviojxr3dpj6cuhsanm7omikklx6cekoyywp3eskf/vFT1JIdc0eizEUhTSi0jfobeAiEF5r9UfWskmYcK.png

but i see my logos uploaded

~/dockerfiles/docker/app/public/storage/ugy1dpuul97nawajvfwkgzvqviojxr3dpj6cuhsanm7omikklx6cekoyywp3eskf$ ls -ltrh
total 216K
-rw-rw-r-- 1 1500 1500 15K Sep 19 07:27 Aq5WGLLOiEF14Sk5OicE4tQLTwprqADTFuA9K6ws.png
-rw-rw-r-- 1 1500 1500 15K Sep 19 07:28 gy3jra97p6g2AzBRrdFInTehVj7dpmYkBVh6jI0y.png
-rw-rw-r-- 1 1500 1500 15K Sep 19 07:44 pt60zdiKAEEjqsqhHA10MfS1Y8hLV1U9Pa7SCQG6.png
-rw-rw-r-- 1 1500 1500 5.0K Sep 19 08:07 ZJKWLADbAkspfkB1ii9TSrY9aADRxjn0CprrRk7Q.png
drwxrwxr-x 4 1500 1500 4.0K Sep 19 08:08 jxRcxVgHPKHP0mLr1x8YVYBlEOmydCqctXoojM0a
-rw-rw-r-- 1 1500 1500 50K Sep 19 08:12 vFT1JIdc0eizEUhTSi0jfobeAiEF5r9UfWskmYcK.png
-rw-rw-r-- 1 1500 1500 50K Sep 19 09:00 TFbOahDq3Pp9B9RMbPyyFjhkdOeAaZoghjp3clzt.png
-rw-rw-r-- 1 1500 1500 50K Sep 19 09:21 QnXZ42Aiv80OPfRjuU5ifOf5YQJTg8Ls0dqZPm7x.png

I have the exact same issue. Uploaded logo shows up fine in the web app. But fails to render in PDF. I am unable to resolve the logo PNG directly via URL like:

https://domain.com/public/storage/u862llnztfvxyacxys8nncxiqd5fagfbk0ve9g9iieiurmcvdesx23sqp9pdovgf/viyJs524s1WFI2raGElK4zxRnfS8IeDDkSLMVAzP.png

Did anyone solve this?

I’m running latest v5 docker image in compose.

Try adding LOCAL_DOWNLOAD=true to the .env file

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

Tried that suggestion. Did not fix the PDF. Also tried pulling the latest docker image (v5.3.66-C77). That also did not fix it. Any other suggestions?

Please create a new post for further help with this issue.

Hello together,
I also had to struggle with the logo being broken on the PDFs, but visible and accessible everywhere else.

With phantomjs it worked fine but slow. When I switching to snappdf the problems started to appear.

The problem seems to be exclusively with snappdf and the headless chromium browser which it uses.

I installed and configured invoiceninja in Plesk on debian 11 via the git repository. Apparently headless chromium has trouble opening the HTTPS link to the logo.
Unfortunately no suggestion in this forum has solved the issue.

My solution, after days of testing:
I created another subdomain that has the public storage as root directory.
In the public .htaccess file I redirect all storage links to this subdomain.

RewriteRule ^storage/(.*)$ https://invoicestorage.example.com/$1 [R=301,L]

Now the logo is finally displayed correctly everywhere!

Thanks for sharing this solution!

cc @david

@Alibaba97

In your web servers config, what’s defined as document root?

I had the same problem with Logo not displayed in PDF invoice.
My problem was a htaccess password .

I removed htaccess password check and now my invoices have the logo :sunny:

1 Like