wood burning stoves 2.0
The moose likes Java in General and the fly likes Printing problem in Unix Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic

Printing problem in Unix

Nikhil Sun
Ranch Hand

Joined: Nov 13, 2005
Posts: 108
I have deployed my java application on a Solaris system.A network printer is connected to this Solaris machine.And from within the java application I am firing a print using Java's Print API.
I am printing a GIF document.But the printer outputs junk characters onto the pages.When the same thing is done on an application deployed on a Windows system and print is fired to a printer attached to this Windows system it prints properly.
Can someone advise me on what would be the problem and how to rectify it?

Please note that Xvfb is present on the Solaris system.I also set the System property java.awt.headless as true inside my application.
Inspite of this when I try and print I am getting the following Exception when I try to print a txt file:

java.awt.print.PrinterException: Printer is not accepting job.
2008-07-02 13:15:57.108 [info] at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1231)
2008-07-02 13:15:57.108 [info] at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1197)
2008-07-02 13:15:57.108 [info] at nia.ps.engine.runtime.printer.TextPrinter.doPrint(TextPrinter.java:216)
2008-07-02 13:15:57.108 [info] at nia.ps.engine.runtime.printer.TextPrinter.print(TextPrinter.java:177)
2008-07-02 13:15:57.108 [info] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2008-07-02 13:15:57.108 [info] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
2008-07-02 13:15:57.108 [info] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
2008-07-02 13:15:57.108 [info] at java.lang.reflect.Method.invoke(Method.java:585)
2008-07-02 13:15:57.108 [info] at nia.ps.engine.runtime.dispatcher.PrintDispatcher.printDocs(PrintDispatcher.java:141)
2008-07-02 13:15:57.108 [info] at nia.ps.engine.runtime.dispatcher.PrintDispatcher.process(PrintDispatcher.java:85)
2008-07-02 13:15:57.108 [info] at nia.ps.engine.runtime.dispatcher.PrintDispatcher.prepareToPrint(PrintDispatcher.java:48)
2008-07-02 13:15:57.108 [info] at nia.ps.engine.runtime.dispatcher.PrintDispatcher.firePrint(PrintDispatcher.java:27)
2008-07-02 13:15:57.108 [info] at nia.ps.engine.PrintEngine.runJob(PrintEngine.java:44)
2008-07-02 13:15:57.108 [info] at nia.ps.engine.PrintEngine.spooler_process(PrintEngine.java:65)

Any help friends?
Carl Pettersson
Ranch Hand

Joined: Sep 09, 2003
Posts: 73
The exception indicates that you do not have permission to use the printer... What user are you running the program as, and which privileges does the printer require? Can you print documents outside of your java program?
Nikhil Sun
Ranch Hand

Joined: Nov 13, 2005
Posts: 108
Now I no longer get the exception and the request to print is going smoothly.But as I try to print the text document,the printer prints but the output is junk characters.What is the reason for this?What is the solution so that the output is properly rendered?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Please do not post the same question to multiple forums: CarefullyChooseOneForum

Let's continue the discussion in this duplicate thread.
I agree. Here's the link: http://aspose.com/file-tools
subject: Printing problem in Unix
It's not a secret anymore!