@david
It is only accessible within my network but It has an internal domain name that resolves to the IP
Hi @kwassef, the problem might be the snap chromium confinement which seem to prevent snappdf getting their headless user flags beeing paresed. It took me hours to find a solution which works even with snakeoil self-certified local domains like .loc or .intranet.
Try this call chromium via âbackdoorâ confinement-free:
SNAPPDF_CHROMIUM_PATH=/snap/chromium/current/usr/lib/chromium-browser/chrome
If not, a trutworthy build is offered by suse here:
https://software.opensuse.org/download/package?package=ungoogled-chromium&project=home:ungoogled_chromium
If all I should do is change this line
SNAPPDF_CHROMIUM_PATH=/snap/bin/chromium
to this
SNAPPDF_CHROMIUM_PATH=/snap/chromium/current/usr/lib/chromium-browser/chrome
and then run php artisan optimize
It did not seem to change anything as the logo is still a broken image
@cdahinten
Hi @kwassef, I see. In your early post your Invoice Ninja looked like beeing served over https:
10.10.1.153 - - [13/Apr/2021:10:29:45 -0400] âGET /client/invoice/sGJ5ckZMN1j45KetY7nK8vggNPr2MpLhctqNEBYyfCS885pwXSVodQGktLHk9M9C/download_pdf HTTP/2.0â 500 1558 âhttps://invoicet.kt.loc/â âMozilla/5.0 (Windows NT 10.0; Win64; x64)
But the logo seems to be pulled over http not https which might cause the exclusion due to strict cert-error-handling in lastest chromium.
[2021-04-18 20:51:04] production.INFO: the path http://invoicet.kt.loc/storage/2aFJosTJjiRb54D6aLQIsLKFes0NQ2bDVJ5hfLvKacLPe3uOW7HfRaanfVbIuaAi/ZAtmJ0e3WVFwLrxZlfX0tQ70JFgE2SCbWNGhCkwM.png
Did you follow this guide which includes a self-certified installation?
https://forum2.invoiceninja.com/t/install-invoice-ninja-v5-on-ubuntu-20-04/4588
I have managed to setup a local non public facing test installation on ubuntu 20.04.2 lts server on rpi with no missing Logos. Snappdf has updated this issue. It should to list
âignore-certificate-errors
somewhere in the source it you look up i.e. here
nano /srv/invoiceninja/vendor/beganovich/snappdf/src/Snappdf.php
But maybee its better to refresh nginx too, because in first attempts I forgot to do this an all changes to http/https where not affected:
sudo service nginx reload
sudo service nginx restart
Self certified install is just an easy example method to get running and testing. It will work by authorizing the provider manually, but public facing sites will require a CA provided cert like Letsencrypt which is popular and free, but I would not write a guide on setting up that for every use case. Just to be clear.
The steps I took were very similar to the guide and snappdf does have the --ignore-certificate-errors in Snappdf.php but i am still not getting a logo
hello @kwassef, I assume your evaluation install is not ssl-encrypted or was setup unencrypted and later changed to https via .env edit. Try to setup with self-encrypted on a fresh install. Side-Loading unencrypted content is a security issue and not working with headless chrome. The invoices are genrated in /tmp where you can find files named like this html_YLgVxJ.html
they contain:
<img class=âcompany-logoâ src="http://xyz.intranet/storage/g3fâŚ
but they should use https.
Thats the reason why IN-Footer-Logo shows off properly but user storage content does not.
I deliver https through an nginx reverse proxy, recently I switched it to http to test if the logo would work but still no luck. Also I have a redirect in place for all http requests in my nginx config. so http://invoice.ninja would instantly be redirected to https://invoice.ninja
Hi @kwassef,
it seems that it is a proxy issue.
Maybee @ben can give you an advice wether it is reasonable to add something like below into the snappdf chromium flags (for testing):
-- proxy-server=http://âŚ
-- allow-insecure-localhost
-- proxy-bypass-list
@kwassef can you see if the flags provided by @cdahinten works for you? If so, Iâll adapt them into snappdf, no problem. Thanks.
not having any luck after adding them
ââproxy-server=10.10.1.15â,
ââproxy-bypass-list=*.kt.locâ,
ââallow-insecure-localhostâ,
just to be sure is this how i would fill these out?(the proxy is hosted on the same machine as the invoice ninja)
Hi @kwassef,
I looked up here for the settings. I made a mistake with quotes:
https://www.chromium.org/developers/design-documents/network-settings
âproxy-server=âhttps://10.10.1.15:443â
or if running unencrypted
âproxy-server=âhttp://10.10.1.15:80â
or in Snappdf.php i.e. like here.
ââproxy-server=âhttps://10.10.1.15:443ââ,
Another issue might be the .loc top-level domain. You can try change to .test.
No luck
I probably misspoke, all of my sites are on the same machine, so I donât think i have nginx setup as a reverse proxy, I just have it to serve certain folders when a request is made with a certain subdomain. Also sorry if I am not very understanding, i am still trying to learn all of this stuff.
One thing that might help is switching to our beta cloud PDF generation service.
That is out of my scope, so @david should be able to provide more info if registration for it is open at the moment.
Thanks.
Please see here, our hosted PDF platform is in beta
https://invoiceninja.github.io/docs/self-host-troubleshooting/#hosted-invoice-ninja-pdf-generation
I have updated to the latest version of invoice ninja v5 and Iâm still having the same issue, the PDF generates beautifully but the logo shows a broken image symbol. For reference, this is a local only selfhosted setup, run through nginx, using ninja_hosted_pdf. Laravel logs do not throw any errors only the link to the logo image which I can access perfectly fine by copying the URL.
I had a look back through this thread. In the HTML output, i can see the logo reference here:
however that URL doesnât exist⌠ie⌠isnât publicly available. The only way you can generate PDFs is for that URL to be resolvable by the system. PhantomJS and our hosted platforms will not be able to work. so you will need to ensure your local system has Snappdf configured and it can resolve the full URL to the logo.
When using Snappdf, I always get this error thrown at me whenever I try to generate the pdf.
500: Internal Server Error
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Server Error</title>
<!-- Fonts -->
<link rel="dns-prefetch" href="//fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
<!-- Styles -->
<style>
html, body {
background-color: #fff;
color: #636b6f;
font-family: 'Nunito', sans-serif;
font-weight: 100;
height: 100vh;
margin: 0;
}
.full-height {
height: 100vh;
}
.flex-center {
align-items: center;
display: flex;
justify-content: center;
}
.position-ref {
position: relative;
}
.code {
border-right: 2px solid;
font-size: 26px;
padding: 0 15px 0 15px;
text-align: center;
}
.message {
font-size: 18px;
text-align: center;
}
</style>
</head>
<body>
<div class="flex-center position-ref full-height">
<div class="code">
500 </div>
<div class="message" style="padding: 10px;">
Server Error </div>
</div>
</body>
</html>
Are there any details about the error in storage/logs/
This is all there is when after I generate a PDF
[2021-06-25 12:37:09] production.ERROR: The file "/var/www/html/ninja/public/storage/2aFJosTJjiRb54D6aLQIsLKFes0NQ2bDVJ5hfLvKacLPe3uOW7HfRaanfVbIuaAi/uB46xNk5KUTUnitIVjdTFuuCiwpQqlTNM766EN96/jOKr2xP82hNjbxmVmLe4loZ4nlua0uXYNKdzHl4i/invoices/INV-2020-0002.pdf" does not exist {"exception":"[object] (Symfony\\Component\\HttpFoundation\\File\\Exception\\FileNotFoundException(code: 0): The file \"/var/www/html/ninja/public/storage/2aFJosTJjiRb54D6aLQIsLKFes0NQ2bDVJ5hfLvKacLPe3uOW7HfRaanfVbIuaAi/uB46xNk5KUTUnitIVjdTFuuCiwpQqlTNM766EN96/jOKr2xP82hNjbxmVmLe4loZ4nlua0uXYNKdzHl4i/invoices/INV-2020-0002.pdf\" does not exist at /var/www/html/ninja/vendor/symfony/http-foundation/File/File.php:36)