ibm 9068 vs olivetti pr2 printer
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Monday, April 14, 2003 03:03 AM

hi there; does anyone know how to get the device events from ibm 9068 printer or olivetti printer? below is the code to do simple printing on the printer, it provide from java comm. import java.io.*; import java.util.*; import javax.comm.*; public class SimpleWrite { static Enumeration portList; static CommPortIdentifier portId; static String messageString = "Hello, world! Hi Tan."; static SerialPort serialPort; static OutputStream outputStream; public static void main(String[] args) { portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { por   More>>

hi there;


does anyone know how to get the device events from ibm 9068 printer or olivetti printer?


below is the code to do simple printing on the printer, it provide from java comm.

			
import java.io.*;
import java.util.*;
import javax.comm.*;

public class SimpleWrite {
static Enumeration portList;
static CommPortIdentifier portId;
static String messageString = "Hello, world!
Hi Tan.";
static SerialPort serialPort;
static OutputStream outputStream;

public static void main(String[] args) {
portList = CommPortIdentifier.getPortIdentifiers();

while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
if (portId.getName().equals("COM1")) {
System.out.println("port name = " + portId.getName());
//if (portId.getName().equals("/dev/term/a")) {
try {
serialPort = (SerialPort)
portId.open("SimpleWriteApp", 2000);
//System.out.println("1");
} catch (PortInUseException e) {}
try {
outputStream = serialPort.getOutputStream();
//System.out.println("2");
} catch (IOException e) {}
try {
serialPort.setSerialPortParams(9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
//System.out.println("3");
} catch (UnsupportedCommOperationException e) {}
try {
outputStream.write(messageString.getBytes());
//System.out.println("4");
} catch (IOException e) {}
}
}
}
}
}
   <<Less
About | Sitemap | Contact