Is there a way of sending directly an "ESC" coded string to an Epson Matrix Printer connected on a USB using Java. I've tried this one using the LPT1 port successfully. However, majority of our clients are now using USB cables instead of the old parellel cables. The main problem I have is how to open the particulary USB where the printer is connected as an outputstream in Java. Thanks in advance for any tips and suggesions.
views:
454answers:
2
+1
A:
This article on JSR-80 might help you. Looks like it's not trivial at all and OS dependent...
Andreas_D
2009-05-20 06:56:52
+1
A:
Since you say LPT1, I assume this is for Windows.
I don't see any 100% Java solution to this, you want to deal with hardware
JNI
You could use JNI to call some windows DLL written in a native language (C/C++/Delphi) that exports one function SendData. You could prepare the data in a temp file (random filename), and the DLL would send it to the printer then delete it.
In Java, you could use load and loadlibrary to load the DLL.
Use some readymade solutions to convert it to USB/LPT
- A driver for your printer.
- NET USE Command
- DOS2USB or DOS2PRN
Osama ALASSIRY
2009-05-25 22:05:34