Forum OpenACS Q&A: Re: Printing with printer control fonts from HTML

Collapse
Posted by Brian Madden on
I found a way to do this directly from HTML using VBScript:

1. Identify the control code that will open the cash drawer, for me this worked by opening a DOS Command prompt and typing "echo ^[p0>lpt1" (my open code is ESC p 0 for an Epson TMU200D connected to LPT1.)

2. In VBScript, use the FileSystemObject to "write" this command to LPT1 as follows:

Set objFS = CreateObject("Scripting.FileSystemObject")
Set objPrint = objFS.CreateTextFile("LPT1:", True)
objPrint.Write(Chr(27) & "p0")
objPrint.Close

3. From your HTML page, execute this script, either onLoad or via button push.

4. Experience joy as the drawer opens!

Hi Brian

The info was pretty needful. Am looking out for printing image, through thermal printer.

Am using ATP-80K printer.

Text printing works very fine. This printer is connected to COM port and not LTP1.

Collapse
Posted by desmond hew on
HI Lakshmikanth
"Text printing works very fine. This printer is connected to COM port"

i have the problem on printing the text to Epson thermal printer(slow printing) where im using php for my system..
Is there anyway to set the printer font at html?

kindly anyone please help

Collapse
Posted by Mark LePine on
Hi Brian

I've got an Epson TM5000II connected on LPT1. The DOS command "echo ^[p0>lpt1" does instantly pop open my cash draw. I can't get your FileSystemObject code to work however. I'm trying to get my cash draw to pop open when I complete a shop transaction on my POS software which is web based. I'm using IE 7. When I put the code into my page all I get is a 'File Not Found' error on the 'Set objPrint = objFS.CreateTextFile("LPT1:", True)' line.

Sorry to be a div but I don't know how to 'execute this script, either onLoad or via button push' part so I simply slotted the code into my page header, which is why I probably get this error. Perhaps you can explain a bit further how to execute this code using OnLoad. If the draw popped open when the page loads it would be ideal.

Regards

Mark