Using iText in an applet

Hey Guys,

im using the library iText in my JApplet to create a PDF. In Eclipse everything works properly but when i start the Applet in my Browser (mozilla firefox or ie) it seems that the program cannot write to the pdf File.

I signed my jar file and the file will be created but the size is 0 kb :-(

Does anybody have an idea why the program cant write to the file?

Here is my code.

if (pdfFile !=null){

Document document =new Document();

try{

PdfWriter pdfWriter = PdfWriter.getInstance(document,

new DataOutputStream(new BufferedOutputStream(new FileOutputStream(pdfFile))));

pdfWriter.setViewerPreferences(PdfWriter.PageModeUseThumbs);

document.addAuthor("MyName");

document.addTitle("myTopic");

document.open();

Paragraph intro =new Paragraph("Der Build Prozess", titleFont);

document.add(intro);

}catch (DocumentException de)

{

view.setInfoText(de.getMessage());

}catch (IOException ioe)

{

view.setInfoText(ioe.getMessage());

}

document.close();

}

Thanks for helping me.

[1755 byte] By [OhNoa] at [2007-11-27 10:23:33]
# 1

the Applet must have the Read/Write on the client machine.

Generally, you have to edit a file in JDK_DIRECTORY\jrelib\security\ directory.

See http://java.sun.com/sfaq/

http://java.sun.com/sfaq/#allowWrite

Hope That Helps

Message was edited by:

java_2006

java_2006a at 2007-7-28 17:22:35 > top of Java-index,Java Essentials,Java Programming...
# 2

Ok i read the tutorial, but i dont understand where i can find the properties file, and what is the name or filetype of the property file? Just "properties" ?

Does anybody understand the tutorial? By the way i use Windows XP and not Unix.

Thanks

OhNoa at 2007-7-28 17:22:35 > top of Java-index,Java Essentials,Java Programming...
# 3

suppose that you want to put your PDFs in C:\pdfs\ directory. Add this: java.io.FilePermission "c:\\pdfs\\", "write"; to your java.policy file situated in JDK_DIRECTORY\jre\lib\security directory

You can also use the Search Forums.

Use some key words like: applet write

Look at the answer 1/ of 21 here http://forum.java.sun.com/thread.jspa?threadID=524815&start=10&tstart=0

Hope That Helps

Message was edited by:

java_2006

java_2006a at 2007-7-28 17:22:35 > top of Java-index,Java Essentials,Java Programming...