Printing Receipt from Django Web Application

前端 未结 3 1757
南笙
南笙 2021-01-31 23:03

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

3条回答
  •  隐瞒了意图╮
    2021-01-31 23:38

    I see two ways to accomplish it:

    First method - Configure your browser

    Notes

    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

    • Manual setup:
      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
    • 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/

    Chrome

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

    Internet Explorer

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

    Second method - Server handles every printer

    Notes

    Good solution if:

    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

    How to do

    1. Connect printers (to the clients and/or to the server)
    2. Share printers connected to clients over the network
    3. Manage every printer from your Django server

提交回复
热议问题