Markdown-preview-enhanced: Images in header/footers in PDF with pupeteer

Created on 6 Sep 2019  ·  2Comments  ·  Source: shd101wyy/markdown-preview-enhanced

Hi,

I'm trying to display an image on my header when printing to PDF with Pupeteer, but I am unable to do it. I'm not an expert on css by any means, so I'm struggling to use the info I find here and there. The info in #1028 was superuseful to get my footer, that has only text, but I can't load an image in the header. I know that pupeteer blocks loading images from the internet, so I need to use a base64 encoded image, but still it doesn't load.

I would like to store the base64 garbage in the css file, if possible, instead of the markdown file, to reduce the clutter.

So far, the best candidate for a solution is this one but I can't make it work.

Any ideas?

Most helpful comment

All 2 comments

Thanks for replying and taking the time to write an example!

I managed to get it working with your help. I understand that the limitation of having to encode the image comes from puppeteer, and that's quite annoying, but at least is something. Using an svg I managed to reduce the image size to 800B, which is quite good.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rcmalli picture rcmalli  ·  4Comments

liuwa666 picture liuwa666  ·  5Comments

shd101wyy picture shd101wyy  ·  4Comments

oneone1995 picture oneone1995  ·  5Comments

AdexoMing picture AdexoMing  ·  3Comments