Sending an invoice with a logo does not work, without a logo it does

Is anyone running into the problem that you can’t put a logo in the invoice?

when I have a logo I get this error when I want to send the invoice.

An uncaught Exception was encountered

Type: Mpdf\MpdfImageException

Why is this in the link below the image is there in the map ///

Message: Could not find image file (file:///padtoroot/web/bill/uploads/872261161.png)

Filename: /web/bill/vendor/mpdf/mpdf/src/Image/ImageProcessor.php

Line Number: 589

Backtrace:

File: /web/bill/vendor/mpdf/mpdf/src/Image/ImageProcessor.php
Line: 211
Function: imageError

File: /web/bill/vendor/mpdf/mpdf/src/Tag/Img.php
Line: 276
Function: getImage

File: /web/bill/vendor/mpdf/mpdf/src/Tag.php
Line: 240
Function: open

File: /web/bill/vendor/mpdf/mpdf/src/Mpdf.php
Line: 13875
Function: OpenTag

File: /web/bill/application/helpers/mpdf_helper.php
Line: 96
Function: WriteHTML

File: /web/bill/application/helpers/pdf_helper.php
Line: 105
Function: pdf_create

File: /bill/application/helpers/mailer_helper.php
Line: 63
Function: generate_invoice_pdf

File: /web/bill/application/modules/mailer/controllers/Mailer.php
Line: 162
Function: email_invoice

File: /web/bill/index.php
Line: 329
Function: require_once

<?php echo $code_example; ?>
1 Like

Concentrate on the fact that the PDF creator is looking for a file through the ‘file://’ protocol, as it looks like.
That’s strange.

Try to use files, local to your webserver, yes. Not https://some-remote-webdite.com/image.jpg

It’s better to find that logo at ‘/assets/logos/company-logo.jpg’.

Hope you see the differences in what you’re using at the moment

That is not working

is this okay that i did the update but it says 1.6 instead of 1.6.0?

The update, you did great, don’t worry about that.

It’s purely that mPDF cannot find your logo, that needs to be found out why

@Michael_Aleixo Check the following pull-request:

It is a very simple fix that will resolve your proem in this case.
We will bring that same solution in the next version we’ll release

1 Like

i had the same problem…

i’ve uploaded the logo for invoices and it’s accessible via browser…

when i try do view a pdf invoice, I get this error…

An uncaught Exception was encountered
Type: Mpdf\MpdfImageException

Message: Could not find image file (file://XXX/uploads/logo1.jpg)

Filename: XXX/vendor/mpdf/mpdf/src/Image/ImageProcessor.php

Line Number: 589

Backtrace:

File: XXX/vendor/mpdf/mpdf/src/Image/ImageProcessor.php
Line: 211
Function: imageError

File: XXX/vendor/mpdf/mpdf/src/Tag/Img.php
Line: 276
Function: getImage

File: XXX/vendor/mpdf/mpdf/src/Tag.php
Line: 240
Function: open

File: XXX/vendor/mpdf/mpdf/src/Mpdf.php
Line: 13875
Function: OpenTag

File: XXX/application/helpers/mpdf_helper.php
Line: 97
Function: WriteHTML

File: XXX/application/helpers/pdf_helper.php
Line: 105
Function: pdf_create

File: XXX/application/modules/invoices/controllers/Invoices.php
Line: 272
Function: generate_invoice_pdf

File: XXX/index.php
Line: 329
Function: require_once

so I tried the suggested fix in invoice_helper.php but then i just got

Message: Could not find image file (https://XXX.com/uploads/logo1.jpg)

i thought it would have something to do with the host being https so i tried setting curlAllowUnsafeSslRequests to true in vendor/mpdf/mpdf/src/Config/ConfigVariables.php and the Logo is showing now…

i don’t know why it’s not working with “curlAllowUnsafeSslRequests false” though. There is a valid letsencrypt certificate in place…

maybe someone has an idea.

chris

the suggested change in the above linked github pull-request didn’t do the trick for me

i replaced that line with following line

        return '<img src="uploads/' . $CI->mdl_settings->setting('invoice_logo') . '" id="invoice-logo">';