PHP 发送数据到打印机 [英] PHP Send data to Printer

查看:70
本文介绍了PHP 发送数据到打印机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 php 程序来生成账单.我已经在我的程序中使用 css 格式化了账单.现在我需要在按下打印按钮后将此数据发送到我的默认打印机.请帮助我将数据发送到打印机的代码

I have a php program to generate a bill. I have formatted the bill using css in my program. Now i need to send this data to my default printer once i press the print button. Please help me with the code that sends the data to the printer

推荐答案

你不能用 PHP 做到这一点,但你可以很容易地使用 JavaScript.

You can't do that with PHP, but you can use JavaScript fairly easily.

当用户点击打印按钮时,只需执行以下操作:

When the user clicks the print button, simply do the following:

window.print();

这将调用默认的系统打印对话框.

This will then call the default system print dialog.

这篇关于PHP 发送数据到打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆