Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #4744

Printing a rtf file ???

From The Nigga <fernandopaivabr@gmail.com>
Newsgroups comp.lang.java.gui
Subject Printing a rtf file ???
Date 2011-11-14 13:08 -0800
Organization http://groups.google.com
Message-ID <e2405e3c-1bc0-4ed2-be18-b8bb48ba91ec@s7g2000yqa.googlegroups.com> (permalink)

Show all headers | View raw


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

Back to comp.lang.java.gui | Previous | NextNext in thread | Find similar


Thread

Printing a rtf file ??? The Nigga <fernandopaivabr@gmail.com> - 2011-11-14 13:08 -0800
  Re: Printing a rtf file ??? Jeff Higgins <jeff@invalid.invalid> - 2011-11-14 17:59 -0500
    Re: Printing a rtf file ??? markspace <-@.> - 2011-11-14 18:05 -0800
    Re: Printing a rtf file ??? The Nigga <fernandopaivabr@gmail.com> - 2011-11-15 08:09 -0800
      Re: Printing a rtf file ??? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-18 03:26 -0800
  Re: Printing a rtf file ??? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-16 21:12 -0800
  Re: Printing a rtf file ??? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-16 21:14 -0800

csiph-web