Hola.
Tengo que crear un pdf.
Tengo este metodo de abajo que trabaja con ficheros fisicos de disco.
bien, mi problema es que el xml no lo voy a tener en disco sino en un
String.
el xsl lo tengo en disco pero lo puedo leer y tenerlo en un String.
me podriais ayudar a cambiar este metodo para poder hacerlo desde un String
(por lo menos el xml)?
y otra cosa.
este metodo devuelve un ByteArrayOutputStream . como podria hacer que esta
salida fuera un void y me lo escribiera a disco el ByteArrayOutputStream ?
muchas gracais y un saludo
public ByteArrayOutputStream getXSL_PDF(String xmlFileName,
String xslFileName) throws IOException, FOPException {
Logger log = null;
Hierarchy hierarchy = Hierarchy.getDefaultHierarchy();
log = hierarchy.getLoggerFor("fop");
log.setPriority(Priority.FATAL_ERROR);
File xmlFile = new File(xmlFileName);
File xslFile = new File(xslFileName);
XSLTInputHandler input = new XSLTInputHandler(xmlFile, xslFile);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Driver driver = new Driver();
driver.setLogger(log);
driver.setRenderer(Driver.RENDER_PDF);
driver.setOutputStream(out);
driver.render(input.getParser(), input.getInputSource());
out.flush();
return out;
}