How to insert an image from your local machine into a string object to be converted by the "html to pdf" node

My problem is that when I convert the page I created in html to the obj string that the 'html to pdf' node needs to receive to do the conversion, this obj string loses the ability to access the path ("<img src="C:\ Users\Desktop\IMAGE.png"">) for the image, as it is no longer a code, but just a text. So I wanted to know if it is possible to insert an image inside the obj string that I pass to the 'html to pdf' node to convert it into a pdf.

You can include image data as base64 encoded string into a html source.
This page (e.g.) has some details.
I'm yet unsure if the html to pdf node understands this properly.

Use a file node to load the image & a base64 node (or node-red-contrib-image-tools to load and output base64) then insert that into your data on the fly.

For the img tag, you need to set the href to a data url

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.