axxshodiq / jzebra

Automatically exported from code.google.com/p/jzebra
0 stars 0 forks source link

Star Printer - '0' on the top left of receipt #45

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Generate Star printer command in code behind - ASP.NET
2. Store above command in a session variable
3. Call the command session variable in Javascript, send to printer via jZebra 
printing object

What is the expected output? What do you see instead?
A transaction receipt. The receipt has been produced just fine, but there is a 
extra '0' appears on the top left of the receipt, just above everything else.

What version of the product are you using? On what operating system?
1.2.2

Please provide any additional information below.
We have 2 different printers, EPSON and Star. It prints without any '0' on the 
Epson, but with Star the '0' appears.
Please see link for the image: 
https://docs.google.com/open?id=0Bw8yYuAnXchPWGV0cF9ZdmdRRVNFWXZTd1U0Y215UQ

Original issue reported on code.google.com by johnnie....@gmail.com on 27 Feb 2012 at 10:39

GoogleCodeExporter commented 8 years ago
Sorry, I must submit by mistake. I meant to type '0' appears on the top left of 
the receipt as my issue title.

Original comment by johnnie....@gmail.com on 27 Feb 2012 at 10:42

GoogleCodeExporter commented 8 years ago
Can you submit a copy of the print commands here or alternately to 
tres.finocchiaro@gmail.com.  Please include eko at wahyudiharto (dot com) as 
well, he has much more Epson experience.

Since the console output may be missing some special characters, please include 
both the console output as well as what ASP is sending (example CHR(27) & 
"ABC", etc)

- Is this reproducible every time?
- Same OS for both?  Any differences worth noting?

If it works with one printer, but not the other my first guess is slight 
incompatibilities with your print commands, but I'd be happy to look at the raw 
output.

-Tres

Original comment by tres.fin...@gmail.com on 28 Feb 2012 at 3:25

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Same with you, Tres. 
It's about incompatibilities with the print commands ( I guess so). Is there 
anyway I can view the code? 
Another my experiences, printing the same code with Epson LX (also 
thermal-printer) & Tally-Dascom resulting a bit different characters size, but 
it doesn't print any weird characters - just like your '0' thing :) 

Original comment by e...@wahyudiharto.com on 28 Feb 2012 at 4:22

GoogleCodeExporter commented 8 years ago
Hi guys,

Thanks for all replies.

I figured out what happened and it was the incompatibilities of my print 
commands. 

This is my cut paper command for Star printer chr(27) chr(100) chr(48).
I assigned this into a session variable while ASP.NET page is running and in 
the end, when user press the finish button, javascript will read from this 
session variable then pass the commands to jZebra printing object.
I think the session variable recognises chr(48) as 0, hence the '0' appears on 
the receipt. If I get rid of this command, the 0 will disappear. It happened to 
my other command to open the cash drawer, chr(27) chr(7) chr(10) chr(50) 
chr(7). It recognises chr(10) as a line feed and when it been passed to 
javascript, it jumps to the next line from the source code. 

Another thing to add, the reason I get ASP.NET to pass the printer commands is 
because the commands are stored in the database, so I need to use ASP.NET 
object to access those commands.

I might need to find a better way to pass the printer commands, please post if 
you have any suggestions. Any suggestion will be appreciated.

Regards,
Johnny

Original comment by johnnie....@gmail.com on 28 Feb 2012 at 5:59

GoogleCodeExporter commented 8 years ago
Johnny,

I would suggest giving the printers unique names, and changing the print 
commands depending on which one is found on that workstation.

i.e:

document.jzebra.findPrinter("epson");
while (!document.jzebra.isDoneFinding()) { // wait }
if (document.jzebra.getPrinterName() != null) {
    alert("Epson attached");
    document.jzebra.append("###EPSON COMMANDS####");
    return;
} 

document.jzebra.findPrinter("star");
while (!document.jzebra.isDoneFinding()) { // wait }
if (document.jzebra.getPrinterName() != null) {
    alert("Star attached");
    document.jzebra.append("###STAR COMMANDS####");
    return;
} 

You can also get all printers and iterate through the array of printer names if 
you wish.

document.jzebra.findPrinter("BOGUS_PRINTER_NAME");
while (!document.jzebra.isDoneFinding()) { // wait }
var printers = document.jzebra.getPrinters().split(",");
for (p in printers) {
    if (printers[p] == "Epson") {
        document.jzebra.append("####EPSON COMMANDS####");
    } else if (printers[p] == "Star") {
        document.jzebra.append("####STAR COMMANDS####");
    }
}

*Note: Try to avoid while() loops if you can, they can make the browser 
unresponsive.  Use setTimeout() or your favorite AJAX library instead, as this 
is just provided as an example.

-Tres

Original comment by tres.fin...@gmail.com on 28 Feb 2012 at 2:30

GoogleCodeExporter commented 8 years ago
Closing bug as "invalid".  Feel free to comment further on here, or contact the 
mailing list for further help.

Original comment by tres.fin...@gmail.com on 28 Feb 2012 at 2:32