Printing a rtf file ???
Hello All
I am trying print one rtf file in my Epson LX300. I can print but
don't know why the print file rtf tags also.
here my code java that I'm using to print.
[code]
public void sendPrinter(File file){
try{
if(file.exists()){
String[] ports = {"LPT1:", "LPT2:"};
String selectedPort = (String)
JOptionPane.showInputDialog(null, "What Port", "Port",
JOptionPane.QUESTION_MESSAGE, null, ports, ports[0]);
if(selectedPort != null){
java.io.InputStream is = new
FileInputStream(file);
Scanner sc = new Scanner(is);
FileOutputStream fs = new
FileOutputStream(selectedPort);
PrintStream ps = new PrintStream(fs);
while(sc.hasNextLine()){
String lines = sc.nextLine();
ps.println(lines);
}
fs.close();
is.close();
sc.close();
file.delete();
}else {
file.delete();
}
}
} catch (IOException ex) {
JOptionPane.showMessageDialog(null, "Do you cant print
this file, file not found","Error", JOptionPane.ERROR_MESSAGE);
file.delete();
}
}
[/code]
Any idea ??
thanks