Welcome to WebmasterWorld Guest from 54.158.228.55

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Can I send printer codes from web page?

esc codes in a print document

     
7:18 am on Jan 3, 2011 (gmt 0)

10+ Year Member



Something tells me this isn't possible. I am working on a script that prints two documents back to back onto a receipt printer from a webpage, and want to issue a "receipt cut" command in between printing these pages. The command is ESC d 1 or decimal 27, 100, 49. Maybe with javascript?
3:04 pm on Jan 3, 2011 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



JavaScript can detect key presses - you'll need to Google the specifics of it.

Anyway, if the key combination you mentioned above is pressed, you could set some boolean variable to false, and just check this variable before the second print function runs.
3:24 pm on Jan 3, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could try embedding an HTML entity sequence in a span or div that is "visible" only when media="print.

<style media="screen">
.receiptCut { display:none; }
</style>
<style media="print">
.receiptCut { display:normal; }
</style>
.
.
.
<span class="receiptCut">&#27;d1</span>
3:27 pm on Jan 3, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry... dec2hex on my first cup of coffee Monday morning...

<span class="receiptCut">&#1b;d1</span>


How and when you embed that into your JavaScript is up to you.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month