• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using FOP

 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic