I am constantly trying to find a good way to use images in this plugin.
First problem, is that this doesn't work:
<img style="float: left;" src="wp-content/uploads/2018/03/fillmorelogo-32px-1.png" alt="logo" />
I read somewhere about how the link is formatted. Does it have to be a direct https://www.domain..............
Does it have to be the path on the server hosting? C:/intpub/
Something else?
Second problem, is there a function to flatten the PDF? Or at least download the images and embed them in the PDF automatically; for offline viewing?
I went looking some more, do I need to use public_path() ?
Is this a different project: https://github.com/barryvdh/laravel-dompdf/issues/344
It appears to be the same issue. I can do everything I want except put a source in the image tag.
Think of Dompdf as a web browser. If you load a page into a web browser the same way you load it into Dompdf would the browser be able to view it?
For example, your example path starts with "wp-content" meaning it's relative to the file location. File location depends on how you've loaded the document. If you load it via the web then it's relative to the URL of the page. If you load it via file, then it's relative to the location of the file on the filesystem. If you generate the HTML and feed it to Dompdf then the path is relative to the executing script on the file system.
If you reference the image via a domain you're less likely to run into problems, but make sure your configuration meets the requirements for loading remote images.
So it helps to know more about the document and how you're using Dompdf.
Second question: All resources that Dompdf is able to parse that are referenced from the HTML are embedded in the PDF so there's nothing extra to do here.
Maybe it would make sense to add the question and answer to the wiki or other place for documentation?
Somewhere on https://github.com/dompdf/dompdf/wiki/Usage for example?
EDIT:
I've added your answer (a little bit modified) to https://github.com/dompdf/dompdf/wiki/Usage#referencing-resources-like-images
I hope that's okay.
That's what a wiki is for! I might tweak/move around but you gotta start somewhere.