Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Cannot print on a USB printer with Java PrintService in Windows 2000. Why?

807601Jan 24 2008 — edited Jan 25 2008
I want to print a simple ASCII file on a USB printer under Win2K and
found 2 problems. Here is the 2nd one.
Even though
PrintServiceLookup.lookupPrintServices(<DocFlavor>, <AttributeSet>)
returns nothing when I specify any AttributeSet, I can still print on the default printer, which I get by
PrintService defServicedefService = PrintServiceLookup.lookupDefaultPrintService();

but only on a parallel printer (HP Laserjet 4 Plus), either directly attached or over the network. When I try the very same code on a locally USB-attached printer, the printer is obviously reacting, but nothing is printed.
In case of a Lexmark 730 (an ink printer), the driver even lies, it has printed 100%,
on a Samsung CLP-510 (a color laser) the ready light flashes twice, that's all.
The file to be printed has 5 lines and a "0C"X at the end in order to force a page eject at the end.

I tried it with JDK 1.4.2 and with Java 6, same problem.

I should mention that I can print that little file out of the editor Textpad without any problem.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 22 2008
Added on Jan 24 2008
4 comments
364 views