• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Using FOP

 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, I have a Servlet that can take form parameters, do a query to the database, make the data into XML, and uses XSLT To transform it into HTML which is sends back through the HTTPServletResponse object. This works perfectly.
Now I am trying to transform that same XML using XSL:FO to become a PDF document that gets sent to the browser via the HTTPServletResponse.
The big problem is that in order to do this FOP requires any object you send to it as being a File. You can't pass InputStream, or StreamSource or Source objects. Well my data, except for the XSL file used to transform the XML to FO, is in streams and not saved in files. I don't want them to be in files because this is ad-hoc, and temp files don't work because multiple users might overwrite even temp files.
Here's my servlet code

You will notice in renderPDF, I gave up and said OK, OK if you have to have a file, I will make one. But it still doesn't work.
Thanks
Mark
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cocoon manages this without writing a separate document file. You might take a look at how they do it xml.apache.org/cocoon/
Bill
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bill.
I also am seeing that FOP also has to use Avalon's Logging, and you need to have that package as well to get it to work.
I am going to look at Cocoon. Hopefully it is more intuitive that FOP.
Mark
 
Space pants. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic