You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ajay Chitre <aj...@diligentteam.com> on 2001/12/28 20:45:57 UTC
FOP, XSL & Struts
Hello,
I am trying to create a report in PDF format using FOP in my Struts based
application. When I use a previously created "fo" file my code works fine.
For example, when I do something like this it works fine;
//This is a test!
String foParam = "c:\\temp\\TestReport.fo"; //TODO
FileInputStream file = new FileInputStream(foParam);
InputSource foFile = new InputSource(file);
ByteArrayOutputStream out = new ByteArrayOutputStream();
//Instantiate Driver
org.apache.fop.apps.Driver driver = new Driver(foFile, out);
driver.setLogger(log);
driver.setRenderer(Driver.RENDER_PDF);
driver.run();
This works!
Now what I would like to do is create the "fo" file dynamically. The report
data is in a collection of Value objects. What's the best way to do this
in my Struts Action class? Please help.
Thanks.
Ajay Chitre
Diligent Team, Inc.
(Where Diligent People Work as a Team)
http://www.DiligentTeam.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: FOP, XSL & Struts
Posted by Ted Husted <hu...@apache.org>.
The Action has direct access to the HttpResponse, and would do it the
same way as any plain servlet.
I can't be more specific without spending more time in the FOP
documentation. But any example for a plain servlet should work in an
Action, just use the provided response instance to obtain the writer.
Ajay Chitre wrote:
>
> Hello,
>
> I am trying to create a report in PDF format using FOP in my Struts based
> application. When I use a previously created "fo" file my code works fine.
>
> For example, when I do something like this it works fine;
>
> //This is a test!
> String foParam = "c:\\temp\\TestReport.fo"; //TODO
> FileInputStream file = new FileInputStream(foParam);
> InputSource foFile = new InputSource(file);
> ByteArrayOutputStream out = new ByteArrayOutputStream();
>
> //Instantiate Driver
> org.apache.fop.apps.Driver driver = new Driver(foFile, out);
>
> driver.setLogger(log);
> driver.setRenderer(Driver.RENDER_PDF);
> driver.run();
>
> This works!
>
> Now what I would like to do is create the "fo" file dynamically. The report
> data is in a collection of Value objects. What's the best way to do this
> in my Struts Action class? Please help.
>
> Thanks.
>
> Ajay Chitre
>
> Diligent Team, Inc.
> (Where Diligent People Work as a Team)
>
> http://www.DiligentTeam.com
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>