Pregunta

I'm writing some applications to automate processes that currently use pen-n-ink or a typewriter.

Because of an overzealousness in our purchasing department, we are forced to use some 3-layer forms for, oh, probably until after everyone that currently works here and their children retire.

While I've never experienced it, I've heard that there are issues using dot-matrix printers with Java...slow printing, won't print, etc.

Can anyone suggest any dot-matrix (or other impact) printers that Java is KNOWN to work with? We're looking at Epson 9 or 24 pin printers.

Also, has anyone used TextPrinter (http://www.java4less.com/textprinter/Documentation.html) with dot-matrix printers -- how well does it work?

Thanks in advance.

¿Fue útil?

Solución

//java print with printer dot matrix

String bill = "your code";

InputStream br = new ByteArrayInputStream(bill.getBytes());
BufferedReader in = new BufferedReader(new InputStreamReader(br));
String line;
//if you use windows
FileWriter out = new FileWriter("////IP Printer//printer name");
//if you use linux you can try SMB:
while((line = in.readLine()) != null)
{  
    System.out.println("line"+line);
    out.write(line);
    out.write(0x0D);  CR
    out.write('\n');
    writer.println(line);
}
out.close();
in.close();
writer.close();

//it work for me...

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top