Receipt Printer - print from webpage

user622378 picture user622378 · Mar 8, 2011 · Viewed 14.7k times · Source

I have a receipt Printer and it connected to Serial COM1 on to my comuter.

I am trying to print a receipt from the webpage and when it print... it just a blank without any text. (Blank receipt!). It work fine on IE8 but not working on Firefox 3.6

I have an Epson TM-T88II Printer and using "Generic / Text" driver on Windows 7.

What is the solution to this?

HTML code of receipt:

<html>
<head>
    <title></title>
</head>
<body>
    <div>
        <div>Company Name</div>
        <div>Customer Name</div>
        <div>Order No</div>
        <div>1 x Item</div>
        <div>1 x Item</div>
        <div>1 x Item</div>
        <div>12.00</div>
    </div>
</body>
</html>

http://jsfiddle.net/bu49K/

Answer

Tres Finocchiaro picture Tres Finocchiaro · Apr 19, 2013

If you are willing to load a java applet, jzebra can print directly to the Epsom TM series thermal printers to COM1 port using the Generic Text driver as you've described.

https://github.com/qzind/qz-print

The problem you are encountering is not uncommon. Generic/Text bypasses the PostScript (2D) capabilities of the Epson print driver.

If using Generic/Text, Epson uses the ESC/P programming language. You will find many tutorials on the internet for printing in this format, and jzebra has more information about this style of "RAW" printing here:

https://github.com/qzind/qz-print/wiki/Raw-Printing

Edit:

To get this working, simply setup your receipt printer as the default printer and rename it as "zebra":

enter image description here

Then simply download the qz-print library, put the jar file in the project directory and hey presto:

<input type=button onClick="print()" value="Print">
<applet id="qz" code="qz.PrintApplet.class" archive="./qz-print.jar" width="100" height="100">
      <param name="printer" value="zebra">
</applet>

<script>
      function print() {
       qz.append("PRINTED USING JZEBRA\n");
       qz.print();
      }
</script>

enter image description here