2

I have issue in print receipt with image in for loop when i am using below code it doesn't load image when multiple print using for loop (It is working fine single print) but i have remove image reference it is work fine. So, Please give me solution.

 function printReceipt() {

        for (var index = 0; index < 10; index++) {

            var imageData = '<img src="./images/image.png"/>';

            var newWin = window.open('', 'Print-Window');
            newWin.document.open();
            newWin.document.write('<html><title>WEB</title><body onload="window.print()">' + imageData + '</body></html>');
            newWin.document.close();
            setTimeout(function () {
                newWin.close();
            }, 200);
        }
    }

    printReceipt();

1 Answers1

0

check this link it may help you : Help Link

try to give alt attribute if image not found for that there may be a chance your URL is not correct :
var imageData = '<img src="./images/image.png" alt="Smiley face" />';

Amitesh Kumar
  • 3,051
  • 1
  • 26
  • 42