I want to convert HTML emails into a PDF. I have written the following piece of code.
var txt = msgs[i].getBody();
/* We need two blob conversion
Interesting problem. Makes sense as to why this doesn't work - PDF conversion doesn't bother "rendering" the HTML to go fetch the image src.
I did a quick test and confirmed that Data URI's (inline images without requiring a separate HTTP call) worked with images.
So, one hacky solution could be go fetch the images and then convert them to Data URI. This has a few downsides - hard to find these images (regex would be fragile or not comprehensive), lots of UrlFetch calls (even with some caching, most automated email senders add trackers so that you end up re-fetching the same image) and slow.
Convert -
<img src="http://images.myserver.com/myimage.png..."/>
To (you can check the content type dynamically as well)-
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhE..."/>