[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Printing in Java



I'm not sure if you've figured this thing out yet so I'll try a quick
answer.

How about the browser sandbox security?  Is it turned off?  Typically
printing is a secured resource just like disk access.
It has been a really long time since I tried applets but I remember that you
need a "signed" applet jar or to simply change the browser settings to allow
applets access to the browser/desktop's resources.

Burr

----- Original Message -----
From: "Minor, Eric" <Enm6@cdc.gov>
To: <ajug-members@www.ajug.org>
Sent: Friday, March 29, 2002 11:32 AM
Subject: Printing in Java


>
>
> I have an application that needs to print the results of a search query to
> the user's printer.
> The print functionality works fine when I test the application in my
> development environment,
> but when I launch the application via an applet in Netscape to test the
> print functionality,
> I either get an exception or Netscape crashes depending on the parameter I
> provide to the
> following method:
>
> This version causes an exception to be thrown saying the owner window is
> null, which is the first  parameter.
>    Note: The signature for this method is  <  public abstract PrintJob
> getPrintJob(Frame frame, String title, Properties props) >.
>
>    PrintJob pJob = Toolkit.getDefaultToolkit().getPrintJob( null,
> "Print Query Results",  new Properties());
>
>   it works fine in the development environment, but not when I launch the
> application from an applet in Netscape.
>
> This version causes a Netscape error which crashes the application in
> Netscape
>
> PrintJob pJob = Toolkit.getDefaultToolkit().getPrintJob( new
> Frame(), "Print Query Results",  new Properties());
>
> When I use the application itself as the parameter for the frame, It works
> fine in development, but not in the runtime environment
>
> PrintJob pJob = Toolkit.getDefaultToolkit().getPrintJob( this,
> "Print Query Results",  new Properties());
>
> Does anyone know of any reason why this would happen or possible have a
> solution.  Your response in greatly
> appreciated.
>
>
> Eric D. Minor
>