marcbachmann / node-html-pdf

This repo isn't maintained anymore as phantomjs got dreprecated a long time ago. Please migrate to headless chrome/puppeteer.
MIT License
3.56k stars 543 forks source link

Image not rendering in header #561

Open abandral opened 4 years ago

abandral commented 4 years ago

Hi All, I am trying to show image in header but it keeps on showing blank space. I tried using options as well as div id="pageHeader" style = "height:75px" img src="http:example.com/abc/aaa"

I even tried to convert image to base64 and set as div id="pageHeader" style = "height:75px" img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA...."

Please help me ASAP.

ivanNieto13 commented 4 years ago

I'm facing the same issue but with the footer, when use pageFooter id or even try including the html code in options and images are not rendered, I read all of posted issues and none helps

ledomskiy commented 3 years ago

Hi!

You must also add the image in your html body with display: none style like below:

<html>
<body>
    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA...." style="display: none;"/>
    ... other content
</body>
</html>

It works for me only for base64 encoded images.