|
[x]
Posted via EE Mobile
|
|
| Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
|
|
|
|
Asked by alexteg in Java Programming Language, Printers
I need to print text in textmode from Java to a Epson TM-T88III Thermal Printer (with paper roll for printing receipts). It's connected to the COM-port (serial 9-pin) and works like a normal printer, however it seems like that when printing from for example Notepad, it converts text to graphics and prints very slowly. So I need to use some of the built in fonts. It should also print without any confirmation from the user. However, when it finishes printing successfully it should report it or otherwise report the error. How can I do all this in java?
I tried doing it through FileOutputStream and PrintStream (see attached code), but it gave me access denied (using Windows XP SP3). I also need to make sure the printer cuts the paper (Feed & Cut). Printing with dialog is not an option. Maybe printing with the Java print API, but I haven't really understood how I can do it easily. Does anyone have a suggestion?
1:
2:
3:
4:
5:
6:
7:
8:
9:
|
try {
FileOutputStream fos = new FileOutputStream("COM1");
PrintStream ps = new PrintStream(fos);
ps.print("Testing");
ps.print("\f");
ps.close();
}catch (Exception e) {
System.out.println("Error: " + e);
}
|
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625