Re: java.security.AccessControlException issue



Thanks Andrew,

so you think a newer sdk is the answer? I want to use the java
pdfviewer
because this site will be used to display answer sets for students.
The idea being I want
to wrap the pdf document and hide from the students the url (as much
as possible) disabling the prnting and
save function they wont be able to pass the answer sets to next years
students


here is the way i was trying to open the file:
File file = new File("http://128.233.22.97/test.pdf";);
FileInputStream in = new FileInputStream(file);
acrobat.setDocumentInputStream(in);


here is the code I am trying ;




import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.applet.*;
import com.adobe.acrobat.*;
import java.lang.*;
import java.net.URL;
import java.util.*;
import java.net.MalformedURLException;




public class SampleReader extends Viewer {

public SampleReader() throws Exception {
}

public static void main(String args[]) {
Frame f = new Frame("Sample Acrobat Reader");

f.setLayout(new BorderLayout());
Label top = new Label("Acrobat Reader created using
adobe.Acrobat.Viewer", Label.CENTER);
top.setBackground(Color.red);
f.add(top, BorderLayout.NORTH);
f.add(new Label("Adobe Acrobat Reader - Alpha release - 1998",
Label.CENTER), BorderLayout.SOUTH);
try {

// Construct a acrobat object aka Acrobar Reader
// note that you must also call its activate
// method before you show the containing panel,
// in this case the frame object.

// The acrobat object is declared as final
// so that it could be referenced in the
// following windowClosing method.

final Viewer acrobat = new Viewer();

f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {

if (acrobat != null) {

// The deactivate method will ensure that the
// acrobat.properties file is saved
// upon exit.

acrobat.deactivate();
}

System.exit(0);
}
});


try
{

// assumes that args[0] is the name of a file
//File file = new File(getParameter("pdffile"));
File file = new File("http://128.233.22.97/test.pdf";);
FileInputStream in = new FileInputStream(file);
acrobat.setDocumentInputStream(in);

} catch (FileNotFoundException x) {
System.out.println("File not found!");
// The viewer will display a blank screen.
// You can then use the Viewer's pop-up menu
// to open a local or remote PDF file.
}

f.add(acrobat, BorderLayout.CENTER);

// you must call activate to enable the Viewer object
// to layout its sub-components and the further
initialization
// needed for it to be displayed.

acrobat.activate(); //WithoutBars();

} catch (Exception x) {
f.add(new Label("Unable to create an Acrobat Reader"),
"Center");
}

f.setSize(400, 400);
f.show();


}
}










On Mar 23, 8:51 pm, "Andrew Thompson" <andrewtho...@xxxxxxxxx> wrote:
On Mar 24, 7:17 am, "merrittr" <merri...@xxxxxxxxx> wrote:

Yep I am using jdk 1.1.8 , that is what this applet requires (its the
adobe java pdf viewer).

Tom has covered most aspects relevant to
this problem, I'd just like to take it in
a slightly different direction for a moment.

1) The PDF viewer does not require '1.1.8',
it requires '1.1.8+'. That is an important
distinction, since the 1.1.8 VM's are becoming
as rare as the teeth of a hen.
2) It will almost certainly be able to accept
an URL as argument for the file.
3) If the PDF is coming off the server, it
should be possible to read it by URL, without
any special privileges.
4) ..and why would you want to use an applet
(as opposed to an application) for reading
PDF's off the local file system (i.e. not
available by URL from the server)?

Andrew T.


.



Relevant Pages

  • Re: Northwind Employee Form and PDFs
    ... Acrobat Reader and Internet Explorer installed. ... > I think you could insert the MS Browser control and display the PDF's ... > the control providing you can currently view PDF docs within Internet ...
    (microsoft.public.access.formscoding)
  • Re: Editors
    ... >>think with that crap Acrobat viewer thing that it ruins an ... in ASM...a lean and mean PDF viewer with a really neat "natural" ... "Acrobat" would be a great project...but, yeah, as you say: ... "Acrobat" so if Acrobat is crap then all PDF files "inherit" that ...
    (alt.lang.asm)
  • Re: full screen view on overhead projector?
    ... If you convert the file to a PDF, you should be able to use the Full ... Screen view in Acrobat (Reader) to display it. ...
    (microsoft.public.word.pagelayout)
  • Texniccenter -> pdf problems
    ... professional as viewer. ... settings to save as pdf. ... I know that it is possible to make a pdf (because I have seen it at ... someone), open the pdf in acrobat, and then remake the pdf after you ...
    (comp.text.tex)
  • multiple document viewew
    ... Anyone know of an Office 2003 document (Word, Excel and Powerpoint) AND PDF ... viewer, ... I need to display the contents of a library ...
    (microsoft.public.sharepoint.windowsservices)