?
Solved

Connecting to a receipt printer

Posted on 2005-04-13
11
Medium Priority
?
968 Views
Last Modified: 2013-11-18
Anybody has an answer on how to communicate a receipt printer? I'm creating a POS (POINT OF SALE) and i have to communicate my delphi application (delphi 7.0) to the receipt printer. what line of command should i use for this? like printing the strings inside my TRichEdit component out to the receipt printer. The printer also has a self cutting capability, how should i do this? what code should i write in order to command the printer to cut the receipt.

Thank you in advance.
0
Comment
Question by:girlswants_me
  • 5
  • 4
  • 2
11 Comments
 

Author Comment

by:girlswants_me
ID: 13770899
Anybody??
0
 
LVL 17

Expert Comment

by:geobul
ID: 13770929
Hi,

Read the printer's manual. Everything (all the commands+parameters) is there. What brand/model is your printer?

Regards, Geo
0
 
LVL 5

Expert Comment

by:Voodooman
ID: 13774933


Hi

You are asking a very difficult problem.

Firstly, this is serial comms and they are very tricky.  You need to have a comm control (or library) that can open the port that you are connected to.

You then need to use the control to send the Escape sequence (usually #27 if I remember correctly) to the port and then you must close the port.

Closing the port is very important and causes people huge problems.  If you don't close the port after use you will not be able to use it again until you restart windows or you have a utility that can close it.

If you have Visual Basic you will have the Comm Control ActiveX that you can use, otherwise I was going to recommend http://www.greenleafsoft.com/CatalogPage.asp?sku=GCX&upd=NO but find that the price is crazy since I bought it.

Epson and Microsoft have a free toolkit that you can download to help you control the printer/drawer/ and display.  The last I looked it was a 6mb download - free to anyone.

This kit took Microsoft and Epson 2 years to develop, so doing it yourself needs a lot of experiment and persisatnce.  I made a Visual Basic AcitveX to do this myself.

Hi Geobul, the Epson Control Set is pretty much standardised and as you say, it's in the book.  What are not standardised however are the cables.  There are many different Serial configurations (v.surprising).  You are going nowhere unless you get the Display, Drawer, Printer and Cables from the same supplier, who needs to be knowledgeable.  You also need the books to setup the dipswitches so that you get the right configuration.

I respecfully suggest that you go back to basics. RTFM, stick some buttons and a comm control on a form and try just to send something to the display alone.  Once you get this working you can move onto the drawer etc.

There is no easy solution to this apart from a lot of hard work.


Voodooman
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 17

Expert Comment

by:geobul
ID: 13775061
The two questions pointed in
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21386980.html
could be helpful.

Voodooman, I agree with you. I'm a programmer in a bank ;-)
0
 
LVL 5

Expert Comment

by:Voodooman
ID: 13776112

Roger that Geobul

I have 10 years contract experience with VB and SQLServer and have worked as DBA with SQLServer.

I am working tonight (10pm here) on one of my own projects.

If you don't want to do the time ... you aren't gonna be a good programmer...... no free rides...


Voodooman
0
 

Author Comment

by:girlswants_me
ID: 13822867
What are "escape" codes? Can you give me an example of that using delphi syntax? Assuming you know the kind of printer...
0
 
LVL 5

Expert Comment

by:Voodooman
ID: 13823763

With whatever comm control you are using

mycomm.port='Com1';
mycomm.portopen;

mycomm.send '#27';

mycomm.port close;

depends your comm control how you open and close the port and how you send it.

What you send depends on your printer - you need the manual for this, although Epson is pretty standard

Example:

#13 is carriage return

#10 - Prints the data in the buffer and  and line feeds


so logically

mycomm.port='Com1';
mycomm.portopen;

mycomm.send 'Voodoman Rules'; //put data in the buffer

mycomm.send '#10'; //clear the buffer and lien feed

mycomm.port close;

You really need to do a lot of homework on this - there are no easy fixes.

Voodooman
0
 

Author Comment

by:girlswants_me
ID: 13831797
is mycomm.send 'Voodoman Rules' and
mycomm.send '#10' valid syntax for delphi 7?

0
 

Author Comment

by:girlswants_me
ID: 13831811
What "T" component should i use for your "mycomm"?
0
 
LVL 5

Accepted Solution

by:
Voodooman earned 500 total points
ID: 13838859
There is no TComponent in Delphi for Serial Comms.

You need to source one.

If you have any version of VB there is a Comm control available, you can wrapper it.

Look on the Internet for a freeware Comm Control for Delphi.

Here is a delphi Library - I haven't tried it but this is something like you need. http://www.delphi32.com/vcl/2092/

You can also do it with Win API - don't ask me how - get a good book on the API like VB Programmers Guide to the Windows API.


Voodooman
0
 

Author Comment

by:girlswants_me
ID: 13949304
ANYOTHER ANSWERS?
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Internet has made sending and receiving information online a breeze. But there is also the threat of unauthorized viewing, data tampering, and phoney messages. Surprisingly, a lot of business owners do not fully understand how to use security t…
Ecommerce has truly become one of the most prosperous ways of monetizing your brand on the Internet. However, when it comes to it, auditing is undoubtedly the lifeblood of this type of business.  This article will help you to conduct your ecommerce …
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question