Home arrow static arrow Java Programming [Archive] - getAppletContext().showDocument() won't show local files for some people
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - getAppletContext().showDocument() won't show local files for some people
10 Duke Stars available
This topic has 1 reply on 1 page.

Posts:1
Registered: 7/23/03
getAppletContext().showDocument() won't show local files for some people  
Oct 16, 2003 5:13 PM



 
Hi,

I have a reporting function that creates a pdf and stores on the users computer in the local temp drive and then displays the created pdf in a new browser window. Everything works fine except for some users it won't show local files. This is a signed applet and everyone has the same policy file. I can't work out why it works for some users and not for others, there doesn't seem to be a pattern in o/s, configurations etc. When i run the code locally on tomcat it works for me but when i upload to server it doesn't. There is no error message either. The pdf is definitely being created as well as you can check it in the temp directory. Code is below:

void btnReport_actionPerformed(ActionEvent e) {
try {
String args[] = {"-pdf"};
File f = File.createTempFile("SCReport", ".pdf");
FileOutputStream fos = new FileOutputStream(f);
JCPrinter printer = SCPrintManager.getPrinter(args, fos);
if (printer == null) {
System.out.println("Printer is equal to null");
}
// What has been selected?
SCReport report = new SCReport(printer);
Vector vectSubConsultant = createVectorFromScreenInfo();
if (vectSubConsultant == null)
return;
report.addSectionForSC(vectSubConsultant, true);

SCPrintManager.printDocument(report.getDocument(), printer);
printer.getOutputStream().close();
URL reportURL = f.toURL();
URLConnection con = reportURL.openConnection();
ReDirector().getAppletContext().showDocument(reportURL,"report");
}
catch (Exception ex) {
System.out.println("Error producing report");
ex.printStackTrace();
}
}
 

Posts:32
Registered: 10/14/03
Re: getAppletContext().showDocument() won't show local files for some people  
Jun 23, 2004 7:47 AM (reply 1 of 1)



 
Did you have any luck? As I am trying to do the same thing...
 
This topic has 1 reply on 1 page.