homepage Welcome to WebmasterWorld Guest from 54.204.58.87
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Can I send printer codes from web page?
esc codes in a print document
salewit




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

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?

 

Readie




msg:4248569
 3:04 pm on Jan 3, 2011 (gmt 0)

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.

rainborick




msg:4248577
 3:24 pm on Jan 3, 2011 (gmt 0)

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>

rainborick




msg:4248579
 3:27 pm on Jan 3, 2011 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved