[英]Print a receipt using react JS
I build a restaurant app using React JS and I want to print a receipt when the order got accepted.我使用 React JS 构建了一个餐厅应用程序,我想在订单被接受时打印收据。 The restaurant has a wifi printer and I have no idea how should I connect a printer with that website.
餐厅有一台 wifi 打印机,我不知道如何将打印机连接到该网站。
There are two ways I know we can do this.我知道有两种方法可以做到这一点。
Windows.print() - When added this native trigger, it'll open the regular print dialog box. Windows.print() - 添加此本机触发器后,它将打开常规打印对话框。 Which in further you can select you printer and one can take print out.
您可以进一步选择打印机并打印出来。
ReactToPrint - react-to-print - This library also help you to achieve the same results but in abstracted manner and some over-the-top modifications. ReactToPrint - react-to-print - 该库还可以帮助您实现相同的结果,但以抽象的方式和一些过度的修改。
Though, if you're wondering that wherever an order is placed but print should be printed then this might not help but I strongly believe that this will help you figure out something.不过,如果您想知道在何处下订单但应打印打印件,那么这可能无济于事,但我坚信这会帮助您找出一些东西。
Some other useful resources:其他一些有用的资源:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.