I have a javascript project that TLDR creates a barcode. On the button click I want to print the barcode that gets generated by the internal guid
I am using the jsBarcode.js
plugin which takes a string and turns it into a barcode. Here is the html markup for that div.
<div id="printable">
<img id="barcode"></img>
</div>
The barcode shows up perfectly it's just when trying to copy it over to a new window it doesnt show up :(
I have tried multiple ways of doing this and have had no luck. Right now I have this code and on the window that pops up it just shows object Object
var printContent = new $('#barcode').clone();
var w = window.open('','','width=340,height=260');
var windowContent = '<!DOCTYPE html>';
windowContent += '<html>';
windowContent += '<head><title>Print canvas</title>';
windowContent += '</head>';
windowContent += '<body>';
windowContent += '<img id="printWindowBarcode">' + printContent + '</img>';
windowContent += '</body>';
windowContent += '</html>';
w.document.write(windowContent);
w.focus();
w.print();
w.close();
I have had no luck with doing this.. I can make just text content show up now problem, but have no clue on how to do it when linking an image with no source... Any help would be greatly appreciated.