AW: Need Working Sample

2001-07-06 Thread Erik Rehrmann

Hi Gustavo,

the following works great:

  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Driver driver = new Driver();
  driver.setRenderer(Driver.RENDER_PDF);
  InputHandler inputHandler = new XSLTInputHandler(xmlFile, xslFile);
  org.xml.sax.XMLReader parser = inputHandler.getParser();
  driver.buildFOTree(parser, inputHandler.getInputSource());
  driver.format();
  driver.setOutputStream(out);
  driver.render();

  response.setContentType(application/pdf);
  byte[] content = out.toByteArray();
  response.setContentLength(content.length);
  response.getOutputStream().write(content);
  response.getOutputStream().flush();

This example lets the servlet stream the result directly to the client browser. If you 
want to have the pdf file on your disk instead, just write use an other output stream!

It currently does not work for IE5.5, but I'll check the hint of Alex McLintock 
earlier in this list.

Hope this helps you out,
___
Erik Rehrmann - IOn AG
[EMAIL PROTECTED]




 -Ursprüngliche Nachricht-
 Von: Wolf Gustavo (SGC-EXT) [mailto:[EMAIL PROTECTED]]
 Gesendet: Freitag, 6. Juli 2001 17:11
 An: '[EMAIL PROTECTED]'
 Betreff: RE: Need Working Sample
 
 
 Hi Jim,
 I have exactly the same problem, and I've just found a non
 elegant, working solution:
 
 I generate my XML file, and then call the command line Fop 
 from within my
 servlet:
 
 Runtime.getRuntime().exec(new String[]{java.exe, -cp,
 c:\\fop\\Fop-0.18.1-DEV\\fop.jar;c:\\fop\\Fop-0.18.1-DEV\\lib
 \\w3c.jar;c:\\
 fop\\Fop-0.18.1-DEV\\lib\\xalan-2.0.0.jar;c:\\fop\\Fop-0.18.1-
 DEV\\lib\\xerc
 es-1.2.3.jar;c:\\fop\\Fop-0.18.1-DEV\\lib\\jimi-1.0.jar,
 org.apache.fop.apps.Fop, -xml , c:\\prueba.xml, -xsl ,
 c:\\prueba.xsl, -pdf , c:\\prueba.pdf}); 
 
 As I said, it is NOT elegant, but after sweating for days 
 with problems of
 all type doing the elegant thing, I get my beautiful PDF on disk.
 
 Of course you should adapt the names of trhe directories  and 
 the xml and
 xsl files.
 
 Cheers,
Gustavo
 
 PS: if someone has an elegant solution I would be happy to 
 use it too. 
 
   -Message d'origine-
  De :Jim Urban [mailto:[EMAIL PROTECTED]] 
  Envoyé :vendredi, 6. juillet 2001 17:09
  À : [EMAIL PROTECTED]
  Objet : Need Working Sample
  
  Hi, I am new to FOP.  I have a servlet which dynamically 
 generates XML.  I
  need to apply an XSL stylesheet containing FO tags to generate a FO
  version of the XML and then I need to run this FO version of the XML
  through FOP (or Driver) so the servlet can return a 
 dynamically created
  PDF to the browser.  Does anyone have a working example of 
 how to do this?
  Only the XSL style sheet containing the FO tags used in the initial
  transform will be on disk.  Please help, I have to get this working.
  
  Thanks,
  
  Jim Urban
  Product Manager
  Netsteps Inc.
  Suite 505E
  1 Pierce Pl.
  Itasca, IL  60143
  Voice:  (630) 250-3045 x2164
  Fax:  (630) 250-3046
  
   Fichier: ATT14204.txt 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




AW: Need Working Sample

2001-07-06 Thread Erik Rehrmann

Jim,

don't be upset! Please take into account that the mails arrived not right on time when 
you sent another mail! I sent my mail BEFORE I saw you're working with memory streams!

It's is possible to handle strings as stream. Have a look at the streams bean of 
alphaworks (streams.jar)
http://www.alphaworks.ibm.com/ab.nsf/techreqs/Streams

Hey, ... keep cool, it's just another deadline ;-)
___
Erik Rehrmann - IOn AG
[EMAIL PROTECTED]



 -Ursprüngliche Nachricht-
 Von: Jim Urban [mailto:[EMAIL PROTECTED]]
 Gesendet: Freitag, 6. Juli 2001 17:52
 An: [EMAIL PROTECTED]
 Betreff: RE: Need Working Sample
 
 
 Sorry, but this does not work for two reasons.
 
 1. The XML does NOT exist on disk!  It is in memory only, and 
 writing it to
 disk is NOT an option.
 
 2. This is a high traffic web application.  Starting a new 
 JVM to process
 FOP is too costly.
 
 There must be a way for this FOP thing to read raw (data only) XML (in
 memory) apply an XSL style sheet to add the FO tags, then 
 format the PDF and
 return it to a browser.  I can't believe I am the first 
 person in the word
 to need to do this.
 
 If I seem upset, I'm sorry.  But I have been fighting with 
 FOP since last
 week to get it to do this.  FOP works great for taking FO files and
 converting them to PDF files, but that's not what I have to 
 do.  I have a
 deadline to meet and I have wasted a week trying to get FOP to work.
 
 Jim
 
 -Original Message-
 From: Wolf Gustavo (SGC-EXT) [mailto:[EMAIL PROTECTED]]
 Sent: Friday, July 06, 2001 10:11 AM
 To: '[EMAIL PROTECTED]'
 Subject: RE: Need Working Sample
 
 
 Hi Jim,
 I have exactly the same problem, and I've just found a non
 elegant, working solution:
 
 I generate my XML file, and then call the command line Fop 
 from within my
 servlet:
 
 Runtime.getRuntime().exec(new String[]{java.exe, -cp,
 c:\\fop\\Fop-0.18.1-DEV\\fop.jar;c:\\fop\\Fop-0.18.1-DEV\\lib
 \\w3c.jar;c:\\
 fop\\Fop-0.18.1-DEV\\lib\\xalan-2.0.0.jar;c:\\fop\\Fop-0.18.1-
 DEV\\lib\\xerc
 es-1.2.3.jar;c:\\fop\\Fop-0.18.1-DEV\\lib\\jimi-1.0.jar,
 org.apache.fop.apps.Fop, -xml , c:\\prueba.xml, -xsl ,
 c:\\prueba.xsl, -pdf , c:\\prueba.pdf});
 
 As I said, it is NOT elegant, but after sweating for days 
 with problems of
 all type doing the elegant thing, I get my beautiful PDF on disk.
 
 Of course you should adapt the names of trhe directories  and 
 the xml and
 xsl files.
 
 Cheers,
Gustavo
 
 PS: if someone has an elegant solution I would be happy to use it too.
 
   -Message d'origine-
  De :Jim Urban [mailto:[EMAIL PROTECTED]]
  Envoyé :vendredi, 6. juillet 2001 17:09
  À : [EMAIL PROTECTED]
  Objet : Need Working Sample
 
  Hi, I am new to FOP.  I have a servlet which dynamically 
 generates XML.  I
  need to apply an XSL stylesheet containing FO tags to generate a FO
  version of the XML and then I need to run this FO version of the XML
  through FOP (or Driver) so the servlet can return a 
 dynamically created
  PDF to the browser.  Does anyone have a working example of 
 how to do this?
  Only the XSL style sheet containing the FO tags used in the initial
  transform will be on disk.  Please help, I have to get this working.
 
  Thanks,
 
  Jim Urban
  Product Manager
  Netsteps Inc.
  Suite 505E
  1 Pierce Pl.
  Itasca, IL  60143
  Voice:  (630) 250-3045 x2164
  Fax:  (630) 250-3046
 
   Fichier: ATT14204.txt
 
 -
 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]