views:

444

answers:

2

I would like to print a sample line on my USB POS (Point-Of-Sale) printer from a java program on Windows XP.

I tried to setup a JPOS implementation but I get exception after exception for a missing jpos.xml or missing javax.usb.propreties file.

Can anyone tell me how to generate thoses files ? They somewhat need to link to an implementation or something like that and I'm not sure what the (rare, unclear and incomplete) documentation means. Any other help would be appreciated.

My current printer model is Star TSP 100 with a USB connector. My printer seems to be connected correctly since I can print a file on it from windows.

A: 

Well finally found it myself. It seems like you need a part of the program from JavaPOS (that part only has interfaces and abstract classes) and you need the library home made from the manufacturer of the device. The jpos.xml is generated after the printer is installed. A software (also provided by the manufacturer) generates entries in the jpos.xml file based on the name of the printer and other settings. You must include this file in your program.

Finally, the following code make the connection to the printer :

POSPrinter printer = new POSPrinter();
// open the printer object according to the entry names defined in jpos.xml
printer.open("printerName");

The method printnormal() is then used to print. If you printing asynchonously, you also need transactionPrint() to empty the buffer.

Silence
I hope this will save someone else a few hours of research.
Silence
A: 

Hello there,

I know the last post was a good while ago but it happens that I am in the same situation as you were, only with a contactless smartcard scanner. I'm unclear with the first part regarding the jpos xml. When saying you need the library home made from the manufacturer of the device you aren't referring to the actual driver, right? And what happens if the specific company from whom i am using the device does not have the tool to generate the jpos.xml? I'm kind of stuck so I'd appreciate even a tip.

Best regards!

nightraven
1- This is not an answer. It should be a comment to my answer.2- Don't worry about posting to "old" questions on this site. You will probably get an answer.3- The answer to your question : I'm indeed not refering to the driver itself. After installing the driver, in the JPOS section of the configuration program for the printer I found a little tool to generate the jpos.xml. Is your printer compatible with JPOS ? That's the first thing you need to check. Then go through the documentation of your printer. Hope it helps !
Silence