aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Java Print service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Java Print service" Watch "Java Print service" New topic
Author

Java Print service

Shivang Vyas
Greenhorn

Joined: Dec 31, 2003
Posts: 4
Hi,
I am developing on Windows Xp with J2SDK1.4.2. I tried to print a text file using the following code. The code detects the printers, even allows selection of the printer to be used for printing, however when Print button is clicked, it does nothing at all. I do not know what is wrong with the code. My printer is otherwise working fine. Please help me if you can.

No Exceptions or error messages are thrown. But nothing is printed.
Thanks in advance,
shivang.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8997
    
    9

I've never done printing in this fashion and since you didn't give us PrintJobWatcher I can't compile this code, but I'd say that starting out by opening a text file then setting the document type to an image (PNG) is probably a bad idea.
Originally posted by Shivang Vyas:



Have you looked over the Java Print Service API User Guide? There's some examples in there that may prove instructive.
[ December 31, 2003: Message edited by: Joe Ess ]

[How To Ask Questions On JavaRanch]
Shivang Vyas
Greenhorn

Joined: Dec 31, 2003
Posts: 4
Hi Joe,
Thanks for your reply. I had added the Print Job Watcher to ensure that the program doesnt end until printing has finished. However, Print job watcher is actually not required. You may do away with the 2 lines that use Print Job watcher and the code should still do printing. The two lines are the instantiation and initialisation of Print Jobwatcher and the call to the method wait till done method.
As regards your opinion about the use of png in the printing format, I have already tried using text_us_plain and so many other formats. But my printers get detected only get detected when I use png, otherwise the code returns null for printers deteced. I am using a Deskjet printer.
I have gone through Java Print Service API thoroughly and only after that I came up with the posting. I am totally clueless as to why my code wont work.
Please see if you could see any reason for it.
Thanks in advance,
Shivang.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Print service