You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Pedro Barco Bernal <pb...@ceh.junta-andalucia.es> on 2002/02/05 13:10:22 UTC
FOP in server don´t works
This class works perfectly at local. But when I try tu run it at server make a Exception...
The Exception is: File out.fo not found....
But the same class works perfectly at local !!
Can someone tell me why?? The server works perfectly with other class...
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerConfigurationException;
import org.apache.fop.apps.Driver;
import org.xml.sax.InputSource;
import java.io.FileOutputStream;
/**
* A Class class.
* <P>
* @author SADIEL
*/
public class FOP2 extends Object {
/**
* Render to PDF. OutputStream must be set
*/
public static final int RENDER_PDF = 1;
/**
* Constructor
*/
public FOP2() {
try{
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource("xsl.xsl"));
transformer.transform(new StreamSource("xml.xml"), new StreamResult(new FileOutputStream("out.fo")));
InputSource inputsource = new InputSource("out.fo");
FileOutputStream out = new FileOutputStream("out.pdf");
Driver driver = new Driver( inputsource, out);
driver.setRenderer(RENDER_PDF);
driver.run();
}catch(Exception e){
System.out.println("Excepcion");
System.out.println(e.toString());
}
}
}