<p>Have you tried to use a absolute path without the «/» at the beginning? (or actually a relative one from the webroot…) <code>&lt;img src="assets/images/site/logo.png" /&gt;</code> </p>

<p>This did the trick in my case.</p>

CC BY-SA 4.0
2018-08-08T20:23:11.327Z
2018-08-08T20:23:11.327Z
Serafin Pazdera
<p>The PDF renderer uses DOMPDF, which expects a HTML document to be supplied. See the DOMPDF documentation to see what types of images are supported.</p>

<p>If you are linking images from a different domain you will need to set the commerce.php config setting of <code>pdfAllowRemoteImages</code> to true.</p>

<p><a href="https://docs.craftcms.com/commerce/v2/configuration.html#pdfallowremoteimages" rel="nofollow noreferrer">https://docs.craftcms.com/commerce/v2/configuration.html#pdfallowremoteimages</a></p>

CC BY-SA 4.0
2018-08-07T18:01:05.727Z
I have the pdfallowremoteimages setting already. I guess my question is where do I grab the image from? The local shop/_pdf directory or somewhere else? I am getting an "Image not found" error in the PDF so it seems like dompdf cannot locate the resource. I have tried <img src="logo.png" /> ans well as <img src="/assets/images/site/logo.png" />
David A McInnis
CC BY-SA 4.0
2019-08-07T16:30:35.210Z
Am also struggling with this, I have `pdfAllowRemoteImages` set to true, and have tried an absolute path to an image on the frontend website (eg https://blah) and a relative path - still getting an empty square and "image not found" error as per comment above
James Greig
CC BY-SA 4.0
2021-02-19T17:19:17.487Z
Having the same issue myself. @jamesgreig did you resolve this?
Terry Upton
CC BY-SA 4.0
2021-02-22T09:56:43.387Z
No I gave up I'm afraid @TerryUpton
James Greig
CC BY-SA 4.0
2018-08-07T02:30:20.767Z
2018-11-02T18:51:00.767Z
2018-11-02T18:51:00.767Z
Luke Holder
<p>Also had the issue, it seems like neither the valid path nor url work, despite of the setting pdfAllowRemoteImages being adjusted.
But you can always base64 encode the image and place that inside the src=&quot;&quot;.</p>

CC BY-SA 4.0
2021-03-10T12:06:04.683Z
2021-03-10T12:06:04.683Z
Len van Essen
<p>How do I embed an image (PNG,SVG or JPG) into a CraftCMS Commerce 2 PDF receipt? I tried importing the svg using an includes. I tried using an img tag and referencing a local file. Nothing seems to work.</p>

<p>David</p>

<plugin-craftcommerce><dompdf>
How can I embed Image into Craft Commerce 2 PDF Receipt
# How can I embed Image into Craft Commerce 2 PDF Receipt

(Asked by: username_0 on 2018-08-06)

How do I embed an image (PNG,SVG or JPG) into a CraftCMS Commerce 2 PDF receipt? I tried importing the svg using an includes. I tried using an img tag and referencing a local file. Nothing seems to work.

David

**Tags:** plugin-craftcommerce, dompdf

---

## 3 answers

### Answer by username_1 on 2018-08-08. Score: 2 | Accepted answer

Have you tried to use a absolute path without the «/» at the beginning? (or actually a relative one from the webroot…) `![](assets/images/site/logo.png)`

This did the trick in my case.


---

### Answer by username_2 on 2018-08-07. Score: 2

The PDF renderer uses DOMPDF, which expects a HTML document to be supplied. See the DOMPDF documentation to see what types of images are supported.

If you are linking images from a different domain you will need to set the commerce.php config setting of `pdfAllowRemoteImages` to true.

<https://docs.craftcms.com/commerce/v2/configuration.html#pdfallowremoteimages>

> **Comments:**
> **username_0**: I have the pdfallowremoteimages setting already. I guess my question is where do I grab the image from? The local shop/_pdf directory or somewhere else? I am getting an "Image not found" error in the PDF so it seems like dompdf cannot locate the resource. I have tried <img src="logo.png" /> ans well as <img src="/assets/images/site/logo.png" />  
> **username_3**: Am also struggling with this, I have `pdfAllowRemoteImages` set to true, and have tried an absolute path to an image on the frontend website (eg https://blah) and a relative path - still getting an empty square and "image not found" error as per comment above  
> **username_4**: Having the same issue myself. @jamesgreig did you resolve this?  
> **username_3**: No I gave up I'm afraid @TerryUpton  

---

### Answer by username_5 on 2021-03-10. Score: 1

Also had the issue, it seems like neither the valid path nor url work, despite of the setting pdfAllowRemoteImages being adjusted.
But you can always base64 encode the image and place that inside the src="".


---

