从Django Web应用程序打印收据 [英] Printing Receipt from Django Web Application

查看:164
本文介绍了从Django Web应用程序打印收据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发基于Web的POS。不幸的是,POS必须通过热敏票据打印机(TM-T88IV,Epson)进行打印。该Web应用程序基于Django。关于用户如何在Web应用程序中单击控件时系统如何自动打印收据,有任何想法吗?

I am developing a web-based POS. Unfortunately, POS must print through a thermal receipt printer (TM-T88IV, Epson). The web application is based on Django. Is there any idea on how the system could automatically print a receipt whenever a user clicks a control in the web application?

我当时正在考虑为此目的在python中创建其他服务,但这会失去使用Web应用程序的目的,该Web应用程序只需要一个浏览器,而无需进行任何额外的安装。

I was thinking of creating other services in python for that purpose, but that would defeat the purpose of having a web application, where all you need is a browser, without any extra installation.

打印机通过某种方式连接到客户端,并且打印应该是无声地表示触发,这意味着不需要人工干预。一旦交易完成,就应该开始打印。

The printer is connected to the client by the way, and the printing should be "silently" triggered, which means that there is no need for human intervention. Once the transaction is finalized, the printing should starts.

任何建议都欢迎!

推荐答案

我看到两种方法来实现它:

I see two ways to accomplish it:

< h3>注释

如果每个客户端都有一台打印机(因为只能使用默认打印机),则是很好的解决方案。请记住,您可以删除打印服务器(对于资源非常有限的设备很有用),使之成为浏览器应自动执行以打开文件的脚本。您可以使用以下命令:

Good solution if you have one printer for every client (because you can use the default printer only). Keep in mind that you can remove your print server (useful for very resource limited devices) making a script that the browser should automatically execute for open your file. You can use something like this:

#!/bin/bash
printer="/dev/usb/lp0"
encoding_needed=true #false

if $encoding_needed; then
    iconv -c -t 437 $1 > $printer
else
    cat $1 > $printer
fi



Firefox




  • 手动设置:

    Firefox

    • Manual setup:


      1. 打开有关:config

      2. 创建新的布尔值名为 print.always_print_silent 并将其设置为 True

      3. 创建一个新的布尔值值 print.show_print_progress 并将其设置为 False

      1. Open about:config
      2. Create a new boolean value called print.always_print_silent and set it to True
      3. Create a new boolean value called print.show_print_progress and set it to False


    • 使用扩展名,例如: https:/ /addons.mozilla.org/en-us/firefox/addon/attendprint/

    • Use an extension, like: https://addons.mozilla.org/en-us/firefox/addon/attendprint/
    • 请记住,有用于制作信息亭的其他扩展,例如:

      Keep in mind that there are other extensions for making kiosks, for example:

      • https://addons.mozilla.org/en-us/firefox/addon/r-kiosk/
      • https://addons.mozilla.org/en-us/firefox/addon/mkiosk/

      您可以使用以下选项启动它:-kiosk --kiosk-printing

      You can start it with those options: --kiosk --kiosk-printing

      有关信息亭模式,请参见: http://support.microsoft.com/ kb / 154780

      For kiosk mode see: http://support.microsoft.com/kb/154780

      注释

      如果出现以下情况,则是很好的解决方案:

      Good solution if:


      1. 您的客户多于打印机(钱少或打印机有故障)

      2. 打印机多于客户(不同打印机或满足不同需求的纸张颜色)

      3. 客户无法直接打印(PDA /智能手机)

      4. 您想知道打印机状态

      1. You have more clients than printers (few money or faulty printers)
      2. More printers than clients (different printers or paper colors for different needs)
      3. Clients that can't print directly (PDA/smartphones)
      4. You want to know the printer status



      < h3>操作方法

      How to do


      1. 将打印机(连接到客户端和/或服务器)

      2. 共享通过网络连接到客户端的打印机

      3. 从您的Django服务器中管理每台打印机

      这篇关于从Django Web应用程序打印收据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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