'node-html-pdf not show image in PDF

I am trying generate PDF from simple code, but no show image. Help me please.

code

pdf.create("Hello <img src='j4.jpg' />").toFile('./pdf/cotizacion.pdf', function (err) {
    if (err) {
        console.log(err);
    } else {
        console.log("File created successfully ");
    }
});

Result: enter image description here

Thanks!



Solution 1:[1]

Can you something like this, since its not reading your image, its taking it as a string.

    <img src={{IMG_URL}} style="width:100%"/> 

Or you can put base64 of image like:

<img src="data:image/jpeg;base64, {{BASE64_DATA_OF_IMG}}" style="width:100%"/>

This will read your image in pdf.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ashishssoni