Node-html-pdf: Header image

Created on 6 Aug 2016  路  8Comments  路  Source: marcbachmann/node-html-pdf

How to insert image into header options? I added 'base' options base: 'file:///D:/work/inventory/resources' and
"header": {
"height": "45mm",
"contents": '<div class='pull-left'>
<img src='logo.svg' alt='App Logo'/>
</div>'
}, but it doesn't help to render logo image.

Most helpful comment

Is there a fix, or workaround, planned for the buggy images in the header?
It's the same problem with linked css as well. Won't work in the header or footer.

All 8 comments

Can you try to put a / at the end of the base option.
I think the path just gets concatenated

But also images in headers and footers are currently a bit buggy. the might not show.

Is there a fix, or workaround, planned for the buggy images in the header?
It's the same problem with linked css as well. Won't work in the header or footer.

I am using base64 encoded images, as linked ones did not show. It seems using base64 works fine at least for headers.

Even base64 encoded images are not working for me. But the strange thing is, if I put the same thing to the body of the pdf, both the images are shown!

To be clear... I add the image to the header... It did not work. While keeping the image tag as it is, I added it to the body. Now both the body and header images are shown. If I remove only the body's image tag, both will disappear! Interesting :smile:

One dirty way to fix it is (Until the issue is fixed), add the image on both the sections and make the body image display: none. Now you have the image only in header.

same problem of THPubs here

Header/footer images load correctly if you load the same image on the body, with display:none

Was this page helpful?
0 / 5 - 0 ratings

Related issues

B-StS picture B-StS  路  5Comments

tashikomaaa picture tashikomaaa  路  5Comments

RodolfoSilva picture RodolfoSilva  路  3Comments

Messilimeng picture Messilimeng  路  4Comments

adman020 picture adman020  路  5Comments