I have been testing Invoice Ninja v5 and the problem I experienced might not be related but the symptom was the same.
I installed version 5.0.35 from the v5-develop branch on GitHub and I also had broken images on the generated PDFs. If I did not set a company logo, the default Invoice Ninja logo did appear correctly however the “Created by Invoice Ninja” logo at the bottom did not.
Logging the HTML I noticed that the default Invoice Ninja logo was loaded directly from https://www.invoiceninja.com/ whereas the “Created by Invoice Ninja” was on the local server.
My testing setup was installed locally on a computer running Linux Mint 20 using the instructions here on this forum provided for installing on Ubuntu 20.04 (Install Invoice Ninja v5 on Ubuntu 20.04). In particular, I used a self signed certificate because my setup is only accessible internally.
Since the images from the public server loaded and the images served locally did not I thought maybe the issue was the self-signed certificate. After some exploration I figured out that I could add the “ignoreHttpsErrors()” option for Browsershot which allowed the generated PDFs to load the images from the local server.
Here is the diff that I made:
diff --git a/app/Utils/Traits/Pdf/PdfMaker.php b/app/Utils/Traits/Pdf/PdfMaker.php
index 6c656b1a7..e0033faa0 100644
--- a/app/Utils/Traits/Pdf/PdfMaker.php
+++ b/app/Utils/Traits/Pdf/PdfMaker.php
@@ -51,6 +51,7 @@ trait PdfMaker
->deviceScaleFactor(1)
->waitUntilNetworkIdle(true)
->noSandbox()
+ ->ignoreHttpsErrors()
->pdf();
}
}