Printing is a piece of cake, Right?, an end user just needs to press the print button, and documents start to flow through the printer. For our inventory system the case is going to be different, our inventory system (InvCross), is being developed on C language and the user interfaces done on ​​wxwidgets (C++). The printer our inventory system is going to work is a printer that supports ESC/POS . So the requirement is "print from c language to an ESC/POS printer".

Printing from C language to an ESC/POS printer

For working out this requirement, we have broken out the requirement on three stages/pieces/sub-processes:

1. Convert the voucher to JSON (this will be automatic), the result an automatic JSON stream . This stage also includes the tasks for creating database tables that supports the setting in the system. Also the configuration of the non-printing & cash drawer. The user interface for the user being able of changing the customer receipt or rather edit the receipt template, the previous discussed user interface is going to generate a second JSON data stream which is not automatic as the first case but manually edited according to the business requirements.

2. This stage is going to join the automatic JSON stream based on the voucher data, and the manually defined voucher template. For the joining a Parser is going to be used. The result a third JSON stream.

3. Based on the JSON stream which is result of previous stage this stage is going to send ESC/POS commands to the printer.

Stage 2 have been already done, the team is working on Stage 1 now.

Main requirement and its sub-processes

A Detailed view of stage 2 (Parsing).

Watch a video of stage 2 sub-process working. On the video You are going to be able to see the three JSON streams we discussed above.

On making the parser helped us a work described in a old article , the referred article was written over 16 years ago, even its age it is still relevant, compiler construction has not changed too much over the last 50 years. Thanks Jan Niestadt. Just guys You should be imagining the speed of the machines of that time, at that time the original Pentium was just released no higher speeds than 400 Mhz. Jan was at that time in university. Thanks engineer Mesa from the compiler construction course too.

We hope to continue our blog writing soon, stay tuned.

Last change: 23.04.2015 10:50

blog comments powered by Disqus