【发布时间】:2014-05-11 14:20:30
【问题描述】:
所以我有这个:
<script>
window.print();
</script>
我想打印这个网址的图片:
http://www.somefancyurl.com/labels/postage/45029dd.png
该页面只显示我要打印的图像。
我试过了:
<script>
window.print('http://www.somefancyurl.com/labels/postage/45029dd.png');
</script>
但这似乎并没有改变什么。
多亏了一些搜索,我想出了这个:
function printLabel(){
popup = window.open();
popup.document.write('<?php echo $order->shipmentLabel; ?>');
popup.print();
return false;
}
但这会尝试打印出<?php echo $order->shipmentLabel; ?> 而不是实际图像。
【问题讨论】:
-
在页面中,像
<html><body><img src='http://www.somefancyurl.com/labels/postage/45029dd.png' /></body></html>这样写html代码并写脚本 -
@TamilSelvan 请你把它放在答案中,因为它有效!
标签: javascript printing