🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #15621

Re: Print in Applet ?

#15621
From: songd
Date: Mon, 17 May 1999 00:00
69 lines
2328 bytes
In article <7hj594$h28$1@ash.prod.itd.earthlink.net>,

You need the security package from the Browser vendor. For Netscape,
get it from
http://developer.netscape.com/docs/manuals/signedobj/capsapi_classes.zip

Here is how to implement Netscape security in you code:
.
.
import netscape.security.PrivilegeManager;  // import pacakges
import netscape.security.ForbiddenTargetException;
.
.
public class yourClass extends Applet {
.
.
  void buttonPrint_actionPerformed(ActionEvent e) {
    try {
        // enable print via PrivilegeManger
        PrivilegeManager.enablePrivilege("UniversalPrintJobAccess");
        // Windows NT print job name can be what ever you want
        PrintJob pj = getToolkit().getPrintJob(null,"whatever",null);
        if (pj != null) {
           Graphics pg = pj.getGraphics();
           this.printAll(pg);
           pg.dispose();
           pj.end();
        }
        PrivilegeManager.disablePrivilege("UniversalPrintJobAccess");
    } catch (ForbiddenTargetException ex) {
      // your error msg
    }

  }
.
.

Good Luck!
David

  "Dew Layman" <Dewey_Layman@Computer-Science.net> wrote:
> I need the same information.
>
> Dew
>
> De Deus wrote in message <3730402B.5DBBB128@ist.lu>...
> >Hello everyone
> >
> >I need some suggestion to print  from my applet.
> >
> >It contains a print button, by pushing it,I whant that it prints my
> >data.
> >
> >Is there a problem with the Java Sandbox?
> > If yes how to go around it properly?
> >
> >Thanks
> >
> >
> >
> >
> >
> >
>
>


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
Technical Details
Message-ID: <7hpuvp$pc$1@nnrp1.deja.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3730402B.5DBBB128@ist.lu> <7hj594$h28$1@ash.prod.itd.earthlink.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,e5c3c4111e0a0de3
X-Google-Attributes: gidf74b3,public
From: songd@my-dejanews.com
Subject: Re: Print in Applet ?
Date: 1999/05/17
Message-ID: <7hpuvp$pc$1@nnrp1.deja.com>
X-Deja-AN: 478766426
References: <3730402B.5DBBB128@ist.lu> <7hj594$h28$1@ash.prod.itd.earthlink.net>
X-Http-Proxy: 1.0 x24.deja.com:80 (Squid/1.1.22) for client 164.224.250.83
Organization: Deja.com - Share what you know. Learn what you don't.
X-Article-Creation-Date: Mon May 17 20:42:33 1999 GMT
Newsgroups: borland.public.jbuilder.java.language
X-Http-User-Agent: Mozilla/4.51 [en] (WinNT; U)