Open sivayekula opened 1 year ago
Same issue.
I am facing the same issue. Initial troubleshooting has led me to believe at least one of the causes is somehow related to things like <span>
and <strong>
tags that encompass the relevant <img>
tags.
Doing a replace on these <span>
's and <strong>
's with something like <p>
then displays the images in the output as expected. Not ideal for all situations, but it might be worth exploring to see if you see similar results in the meantime.
I had a similar issue, but only when the src
attribute is a URL.
Looking at the source code, it should work: https://github.com/privateOmega/html-to-docx/blob/2ae805da708e2b3c332cacfe63d0fc55b1c06c89/src/helpers/render-document-file.js#L34
But if I use imageToBase64
and replace <img src="<url>" />
with <img src="data:image/png;base64,<image in base64>" />
before calling HTMLtoDOCX
, it works. I'm still not sure why.
On my end, images show up in the document but only after the user sees "Word found unreadable content in "filename". Do you want to recover the contents of this document? If you trust the source of this document, click yes."
Using base64 directly, since using the URL omits the image entirely. But would like to figure out why an image is screwing up the file.
I have html content with images. I am converting images to base64 format in the html string. Content is showing fine. But images are missing in the docx file. Please help me what I am doing wrong My html string like this