You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by kyle koss <kk...@xperient.net> on 2002/08/15 19:53:41 UTC

Can cocoon write pdf to a file?

Is it possible for Cocoon to do an XML+XSL -> PDF transformation, but
instead of serving the PDF into the browser, writing it to a file?
 
What I would like to do is, take information entered into a form on a
jsp page, turn it into an XML file, and then apply my XSL to it to
produce a PDF which is then stored to disk on the server.
 
Can this be done using Cocoon, or would it be easier to just use FOP
embedded in a servlet? If it can be done, what do I have to do?
 
Regards, Kyle Koss

Re: Can cocoon write pdf to a file?

Posted by Ross Gardler <ro...@saafe.org>.
kyle koss wrote:
> Is it possible for Cocoon to do an XML+XSL ->  PDF transformation, but instead of serving the PDF into the browser, 
> writing it to a file?

You can from the command line (I think the following will work (although 
I have never used it):

java -cp [classpath] org.apache.cocoon.Main -c -d[docs.dir] 
-w[work.directory] [start.file]

Ross


> 
>  
> 
> What I would like to do is, take information entered into a form on a 
> jsp page, turn it into an XML file, and then apply my XSL to it to 
> produce a PDF which is then stored to disk on the server.
> 
>  
> 
> Can this be done using Cocoon, or would it be easier to just use FOP 
> embedded in a servlet? If it can be done, what do I have to do?
> 
>  
> 
> Regards, Kyle Koss
> 




---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Can cocoon write pdf to a file?

Posted by Justin Fagnani-Bell <ju...@paraliansoftware.com>.
On Thursday, August 15, 2002, at 10:53 AM, kyle koss wrote:

> Is it possible for Cocoon to do an XML+XSL -> PDF transformation, but 
> instead of serving the PDF into the browser, writing it to a file?
>
> What I would like to do is, take information entered into a form on a 
> jsp page, turn it into an XML file, and then apply my XSL to it to 
> produce a PDF which is then stored to disk on the server.
>
> Can this be done using Cocoon, or would it be easier to just use FOP 
> embedded in a servlet? If it can be done, what do I have to do?

I can't think of any way to do this with the included Cocoon components, 
but you could write an action that does this. Create a matcher that does 
the XML+XSL->PDF transformation, then in an action access the url for 
that matcher and saves to a file. I forget if action can access a 
pipeline with in an action with something like 
resolver.resolve("cocoon:/pdf"), if not you'll have to use the 
java.net.url classes.

You could also write an action that actually loads the file, performs 
the transformation, serializes to PDF and writes the file, all 
configurable by sitemap parameters, but the action that saves a url to a 
file seem more generally usable, it could be a good addition to Cocoon.

Justin


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>