Since we're on the subject of embedding FOP... I still can't figure out how to specify the FOP Driver to load the user configuration file from inside a servlet. You need this if you want to have your servlet support fonts other than the built-in ones.
The docs say use something like: Options opt = new Options(); opt.loadUserconfiguration("/path-to-user-conf/userconfig.xml"); But there are no calls on the Driver object (that I can see) to get it to use the alternate Options object. Any thoughts? Ramin > -----Original Message----- > From: Jim Urban [mailto:[EMAIL PROTECTED]] > Sent: Monday, November 12, 2001 11:08 AM > To: [EMAIL PROTECTED] > Subject: RE: Question on XSLTInputHandler > > > Here is a block of code our of one my servlets. This code takes a string > containing XML, applies an XSL:FO style sheet to it, and runs the XML:FO > through FOP and send s the PDF directly back to the browser. > > Writer out = new StringWriter(); > Transformer pdfTransformer = > NsTransformerCollection.loadTransformer("my.xsl");; > String xmlString = ..... > Source xmlSource = new StreamSource(new StringReader(xmlString)); > pdfTransformer.transform(xmlSource, new StreamResult(out)); > out.close(); > String fopstring = out.toString(); > InputSource foSource = getInput(fopstring); > try > { > ByteArrayOutputStream out = new ByteArrayOutputStream(); > uResponse.setContentType("application/pdf"); > Driver driver = new Driver(iInputSource, out); > driver.setRenderer(Driver.RENDER_PDF); > driver.run(); > byte[] content = out.toByteArray(); > uResponse.setContentLength(content.length); > uResponse.getOutputStream().write(content); > uResponse.getOutputStream().flush(); > uResponse.flushBuffer(); > } > catch (Exception e){} > > Jim > > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Monday, November 12, 2001 12:49 PM > To: [EMAIL PROTECTED] > Subject: Question on XSLTInputHandler > > > Hello, > > I've looked at the example servlet and found that the XSLTInputHandler > takes as input a java.io.File. However, I am constructing the XML > document dynamically and have it as a java.lang.String in memory. It > seems unnecessary I/O to write it out to a temporary file, just to pass > it to the XSLTInputHandler. Looking at the source of > XSLTInputHandler.java I didn't find any alternate way to call it. What > would the recommended procedure be in this case, where I already have > the XML document in memory? > > thanks in advance for any pointers, > > Ulrich > > -- > Ulrich Mayring > DENIC eG, Systementwicklung > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, email: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, email: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]