M
M
mrol2014-03-22 22:58:21
linux
mrol, 2014-03-22 22:58:21

How to work with Chinese POS printer from Java in linux?

Hello.
There is a printer connected via USB. It is necessary to organize printing on it from Java (text and images).
I see several possible ways:
1) The device is mounted as /dev/usb/lp0 and write to file "/dev/usb/lp0" can be called. But at the same time, it is not possible to print Russian letters (enumeration of encodings did not help) and it is not clear how to print images.
2) Print on it as a printer. Unfortunately, I could not find drivers for it (or rather, they are included, but when I installed them according to the manufacturer's instructions, CUPS crashed for me).
3) Stumbled upon the JavaPOS library. But among the supported devices, my printer is not there, perhaps it is similar to some other, but it is not clear how to determine which one.
Actually, problems arise in every possible direction of development, I would like to know which one would be more logical to move in and how to solve them?
Thanks in advance for your replies.
Linux Mint 16 is used as the operating system. The printer accurately supports Russian letters and image printing, there are drivers for Windows and everything is printed easily from Word.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
klirichek, 2014-08-06
@mrol

This is a link printer (lp). It can simply print directly the text that is sent to it (i.e. just open the desired port and send bytes to it).
With the help of escape sequences, you can switch the printer to graphical mode and control additional features specific to POS (for example, open the cash register lid. Or automatically print a barcode).
Those. in the simplest case - translate the printer into the desired code page using the esc sequence and then simply send text to it in the desired encoding.
If you use the driver, then all the capabilities of the printer come down to graphic printing (this is a CUPS raster filter. And by the way @ntktnot quite right about PostScript support. PPD files in cups are their own entity, as they usually describe all printers in general.) Then you have a "standard" printer with a 58 mm paper format. All rendering to bitmap is handled by CUPS, and the filter only parses the print settings and then adds the necessary escape sequences to output the bitmap.
By the way, the filter seems to have been written by the Indians :)
The settings in the PPD does not show, but crashes itself. And besides, it is provided only in the form of a 32-bit binary. I fiddled around with it for a couple of days trying to set it up. As a result, I freaked out and wrote my own filter. He works.
https://github.com/klirichek/zj-58

@
@ntkt, 2014-03-23
_

Here is the contents of the readme: pastebin.com/HQgBsGgk
Here is the contents of the install script: pastebin.com/Arzbs9XS

@
@ntkt, 2014-03-23
_

What exactly collapsed? There are, in fact, no drivers there, only a PPD file, i.e. the printer supports PostScript, and its own custom bitmap filter (rastertozj58).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question