打印机打印损坏的图像图标,而不是参考图像

时间:2018-08-06 07:54:40

标签: javascript php jquery html

我正在尝试在网页上打印图像。 img标签的外观如下:

<img alt='testing' src='barcode.php?text=$invoice_no'/>

但是,当我打印网页时,页面显示的是残破的图像图标,而不是实际的图像(请参见下文)。

我需要怎么做才能让打印机打印参考图像?

picture of broken image icon on printed page

这是我的脚本

<script>
function printData()
{
var divToPrintd=document.getElementById("result");//Div ID
newWin= window.open('', 'Print', 'width=100%,height=100%');
newWin.print();
newWin.close(); 
}
$('#printm').on('click',function(){
printData();
}) 
</script>

2 个答案:

答案 0 :(得分:0)

此代码是php变量的一部分吗?或只是一个HTML?

<img alt='testing' src='barcode.php?text=$invoice_no'/>

如果只是html,请像这样使用它

<img alt='testing' src='barcode.php?text=<?=$invoice_no?>'/>

别忘了在php.ini中打开短标签。

答案 1 :(得分:-1)

首先,您必须将上述图像转换为.jpg,然后根据需要使用它

相关问题