0

i am trying to print on the USB port with EPSON LX 350 dot matrix print. i am using windows 8.1 and printer can print test page in printer properties.

When i try to print some string, it runs without any problem. I see printer name as output. And i see 'java printing' line for 1 second in the printer status dialog of windows control panel. Then it disappear like it is finished printing. But it doesnt print and there is no activity in the printer. Here is the code i use for printing :

String defaultPrinter = PrintServiceLookup.lookupDefaultPrintService().getName();
System.out.println("Default printer: " + defaultPrinter);
PrintService service = PrintServiceLookup.lookupDefaultPrintService();

InputStream is = new ByteArrayInputStream("hello world!\f".getBytes("UTF8"));

DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
Doc doc = new SimpleDoc(is, flavor, null);
DocPrintJob job = service.createPrintJob();

job.print(doc, null);
is.close();

Is the problem about computer or java code or printer?

acpuma
  • 479
  • 5
  • 15
  • Pointer to control characters: http://support.epson.ru/upload/library_file/14/esc-p.pdf - maybe initializing printer after failed attempt, with `"\u001B@"`. Code is fine, though could do: `getBytes(StandardCharsets.UTF_8)` (one Exception less to catch, as UTF-8 always present). – Joop Eggen Apr 16 '14 at 13:27
  • I was already using control characters for printing to lpt without any problem. And i used same for usb, i think the problem is not with characters. – acpuma Apr 17 '14 at 08:22

2 Answers2

1

After i plugin printer, windows 8 automatically installed driver for Epson LX-350. And i was using this driver. After i downloaded printer driver from website, printer worked as expected

acpuma
  • 479
  • 5
  • 15
  • 1
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment). – Filipe Gonçalves Apr 17 '14 at 10:18
  • 2
    This is how i solved my question after trying everything for 3 days. So i believe it is an answer not a comment. – acpuma Apr 17 '14 at 10:21
0

I've had the same problem, i could solve it after install two driver/software:

  • Printer Driver v1.00
  • Status Monitor v4.02

You can get it here.

Tobi Nary
  • 4,566
  • 4
  • 30
  • 50