xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tobias Mueller" <tmuel...@a-i-c.de>
Subject AW: Problem after generating PDF
Date Wed, 01 May 2002 07:20:07 GMT
Hi!

In my case, the following code worked:

import java.io.*;
import java.util.*;

import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;

import org.apache.fop.apps.Driver;
import org.apache.fop.apps.Version;
import org.apache.fop.apps.InputHandler;
import org.apache.fop.apps.XSLTInputHandler;

//import org.apache.log.*;

public class generatePDF {

	public String Publish(String XMLfile, String XSLfile, String outFile)
throws Exception {

		File MyXMLfile = new File(XMLfile);
		File MyXSLfile = new File(XSLfile);
		FileOutputStream MyOutputFile = new FileOutputStream(outFile);

		try {

			Driver driver = new Driver();
  			driver.setRenderer(Driver.RENDER_PDF);
  			InputHandler inputHandler = new XSLTInputHandler(MyXMLfile, MyXSLfile);
  			XMLReader parser = inputHandler.getParser();
  			driver.setOutputStream(MyOutputFile);
  			driver.render(parser, inputHandler.getInputSource());
  			MyOutputFile.close();

		} catch (Exception ex) {

			System.out.println(ex);

		}

  		return "built " + outFile;
	}

}

Hope this helped you out,

Tobi


-----Urspr√ľngliche Nachricht-----
Von: Ingo Peter [mailto:ingo.peter@ip-software.de]
Gesendet: Freitag, 3. Mai 2002 12:11
An: fop-user@xml.apache.org
Betreff: Problem after generating PDF


Hi,
I use fop embedded to generate pdf-files and it works very fine.
But after generating the pdf, I have to close my java-application, because
the the outputfile is still open.
If I don't close my application acrobat tells me a locking-error.

I use the example for empedding from apache:

  Driver driver = new Driver();
  driver.setRenderer(Driver.RENDER_PDF);
  InputHandler inputHandler = new XSLTInputHandler(xmlFile, xslFile);
  XMLReader parser = inputHandler.getParser();
  driver.setOutputStream(new FileOutputStream(outFile));
  driver.render(parser, inputHandler.getInputSource());

Is there any command to close the outputfile?

thanks
IP


Mime
View raw message