See http://xmlgraphics.apache.org/fop/0.93/embedding.html
<http://xmlgraphics.apache.org/fop/0.93/embedding.html>  and the related
examples
 
-----Original Message-----
From: Vivek Ananda [mailto:[EMAIL PROTECTED]
Sent: Saturday, 16 June 2007 23:05
To: fop-users@xmlgraphics.apache.org
Subject: Help Upgrading from v.20.5 to v.93


Hi All, 
  We are using an action class to generate PDF document. We want to use the
v.93 of fop.jar file. However looks like in the new jar file
"org.apache.fop.apps.Driver" is missing. Is there an alternate method I need
to use or should I rewrite the action class. 
 

 private ByteArrayOutputStream transformXMLDocument(String
xslFile,XMLDocument xml,HttpServletRequest request) throws
MalformedURLException, XSLException, UnsupportedEncodingException,
IOException, FOPException {
  ByteArrayOutputStream out = new ByteArrayOutputStream(); 
  xslFile = this.getServlet().getServletContext().getRealPath(xslFile);
  URL fileURL = new URL(" file:/// <file:///> " + xslFile);
  XSLProcessor xslProcessor = new XSLProcessor();
  XSLStylesheet xslStyleSheet = xslProcessor.newXSLStylesheet(fileURL);
  xslProcessor.setParam("", "loginId", "\" "+
getUserContext(request).getUserFullName()+" (" +getCurrentUserId(request) +
" )\""); 
  xslProcessor.setParam("", "todaysDate", "\""+ ICaseUtil.getStringDate(new
Date(),ICaseConstants.DATE_FORMAT_TIME) + "\"");
  ByteArrayOutputStream out1 = new ByteArrayOutputStream(); 
  xslProcessor.processXSL(xslStyleSheet,xml, out1);
  String v_encode = "UTF-8";
  String fopString = new String(out1.toByteArray(),v_encode);
  Driver driver = new Driver(); 
  driver.setRenderer(Driver.RENDER_PDF);
  driver.setInputSource(new InputSource(new StringReader(fopString)));
  driver.setOutputStream(out);
  driver.run();
  return out;

 }

 

Any help is appreciated. 

Thanks in advance.

Vivek

Reply via email to