javascript - 打印机打印损坏的图像图标而不是参考图像
问题描述
我正在尝试在网页上打印图像。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>
解决方案
这段代码是 php 变量的一部分吗?还是只是一个 html ?
<img alt='testing' src='barcode.php?text=$invoice_no'/>
如果它只是一个html,像这样使用它
<img alt='testing' src='barcode.php?text=<?=$invoice_no?>'/>
不要忘记在 php.ini 中打开短标签。
推荐阅读
- bash - 在带有变量的bash中输入文件开头和结尾的行
- ios - 集合视图内容未显示在视图中
- pine-script - 真实强度指标策略
- python - AttributeError:“学生”对象没有属性“_values”
- ios - IOS 应用程序在添加时在 info.plist 中缺少目的字符串
- julia - 将可变长度 MVector 的异构元组推广到可变数量的 MVector
- php - 如何在 PHP 中遍历 JSON 对象
- typescript - 优化打字稿中的字符串生成器
- javascript - js - 我可以用数字转换一个数字吗?
- python-3.x - Python Azure sdk - 启用磁盘加密