首页 > 解决方案 > 打印机打印损坏的图像图标而不是参考图像

问题描述

我正在尝试在网页上打印图像。img标签如下所示:

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

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

我需要做什么才能让打印机打印引用的图像?

打印页面上损坏的图像图标的图片

这是我的脚本

<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>

标签: javascriptphpjqueryhtml

解决方案


这段代码是 php 变量的一部分吗?还是只是一个 html ?

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

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

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

不要忘记在 php.ini 中打开短标签。


推荐阅读