The file you're trying to create when they get that message must be the
same path/name as one they already have open. It happens to me in 2k and
XP; I don't know that Acrobat ever lets you overwrite a file it already
has open.

-----Original Message-----
From: Nicolas Michael [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 17, 2003 9:45 AM
To: [EMAIL PROTECTED]
Subject: FOP locks output file under WinXP


Hi there!

I've embedded FOP 0.20.4 in an application. I use it to create a PDF
file and 
launch Acrobat to display the generated file. With Linux and Win98 this
works 
fine.
But some of my users use WinXP and have the problem, that Acrobat Reader
[6.0] 
cannot open the generated PDF file "because it is still in use by an
other 
application". [JRE 1.4.1]

Here is some code to demonstrate the problem.
args[0] is the input xsl-fo file, args[1] is the pdf output file and
args[2] 
is the path to the Acrobat Reader exe file.

I'd be glad if someone could help me how to solve this problem. Thanks!!

--------------------------
class Test {

  // args: Test <xsl-fo file> <pdf output file> <path to acrobat reader>
  public static void main(String[] args) {
    try {
      org.apache.fop.apps.Driver driver =
        new org.apache.fop.apps.Driver(new
org.xml.sax.InputSource(args[0]),
                                       new
java.io.FileOutputStream(args[1]));
      driver.setRenderer(org.apache.fop.apps.Driver.RENDER_PDF);
      driver.run();
      String[] cmd = new String[2];
      cmd[0] = args[2];
      cmd[1] = args[1];
      System.out.println("Starting Acrobat: "+cmd[0]+" "+cmd[1]);
      Runtime.getRuntime().exec(cmd);
      Thread.sleep(20000);
      System.out.println("done.");
    } catch(Exception e) {
      e.printStackTrace();
    }
  }

}
--------------------------

-- 
man liest sich...

Nicolas Michael
mailto:[EMAIL PROTECTED]     http://www.nmichael.de/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to