цикл создания штрихкодов, здесь может быть запрос на сервер?
var tempDiv=document.createElement('div');
tempDiv.innerHTML = '<div style="width:50mm;height:40mm;font-size:5mm;position:relative;background-color:#eee;overflow:hidden;margin:0;padding:0">\
<img style="position:absolute; cursor:pointer; top:5px; left:5px; width:10mm; height:10mm;" src="/ctrl/ctrl/DM.ctrl?label=279" data-field="DM">\
</div>';
и в конце цикла
prn.document.write(tempDiv.innerHTML)