You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by TS...@uk.imshealth.com on 2002/02/28 16:58:29 UTC

Using FOP from ASP

>  I'm using FOP in a Windows environment and I want if possible to be able
> to process a large batch of .fo files using a script. The easiest way for
> me to do this is to use FOP as a COM object.
> Can I do this?
> So far I've tried:
> - including the path to fop.jar in my classpath variable
> - using javareg.exe to register org.apache.fop.apps.Driver as
> fop.apps.Driver
> - creating a new ActiveXObject "fop.apps.Driver"
> but object isn't created.
> 
> Your help is much appreciated.
> Tom
> 
> 
> 

Re: Using FOP from ASP

Posted by Bertrand Delacretaz <bd...@codeconsult.ch>.
On Thursday 28 February 2002 16:58, TSchutzerWeissmann@uk.imshealth.com 
wrote:
> >  I'm using FOP in a Windows environment and I want if possible to
> > be able to process a large batch of .fo files using a script. The
> > easiest way for me to do this is to use FOP as a COM object.
> > Can I do this?

Not out-of-the box AFAIK, only MS-specific java programs will work as 
COM objects, or you need a COM-to-java bridge which is not very common 
and usually fairly hard to setup.

It might be much easier to simply call FOP as an external process, 
something like "java . . .  org.apache.fop.apps.Fop".

Another option would be to use FOP over an HTTP interface: configure 
FOP as an HTTP servlet (using Cocoon for example) and call it from your 
ASP code: 

-ASP sends HTTP request to FOP backend
-FOP responds with a PDF document which ASP can use

Depending on your configuration FOP or Cocoon might have to make 
another request to your app to get the input XML - sounds a little 
complicated but is not hard to do once you get a clear picture of the 
interactions.

This would give you a much more modular solution, and much less 
configuration headaches.

Hope this helps!
-- 
 Bertrand Delacrétaz (codeconsult.ch, jfor.org)

 buzzwords: XML, java, XSLT, cocoon, mentoring/teaching/coding.
 disclaimer: eternity is very long. mostly towards the end. get ready.






Re: Using FOP from ASP

Posted by David Wood <ob...@panix.com>.
I just set up FOP to run from ASP/VBScript, using WScript.Shell...
Unfortunately, it's non-trivial if you want to monitor FOP's output to
know if it succeeds or fails. I can talk about that if anyone's
interested but it'll get long...

However, to simply use the Run method to blindly run FOP, it shouldn't be
so bad... (disclaimer: untested code)

--

' Execute FOP to render a PDF. We execute it via a command-line
' interface provided via the Windows Scripting Host.
Dim Shell
Set Shell = Server.CreateObject("WScript.Shell")
Shell.CurrentDirectory = FOPDirectory ' Full path to where you put it...
' Now we have to generate a command line which will take our raw XML,
' process it with our template, and produce a PDF in the proper location.
Dim commandline
commandline = "fop.bat"
commandline = commandline & " -xml " & XMLFilename ' Set vars accordingly...
commandline = commandline & " -xsl " & XSLFilename
commandline = commandline & " -pdf " & PDFFilename

' Now we have our command line. Let's execute it.
Dim ResultCode
ResultCode = Shell.Run(commandline,,True) ' True = Wait for FOP to finish

--

BTW, I'd suggest upgrading to the newest version of MS Scripting if you
haven't already.


On Thu, 28 Feb 2002 TSchutzerWeissmann@uk.imshealth.com wrote:

> >  I'm using FOP in a Windows environment and I want if possible to be able
> > to process a large batch of .fo files using a script. The easiest way for
> > me to do this is to use FOP as a COM object.
> > Can I do this?
> > So far I've tried:
> > - including the path to fop.jar in my classpath variable
> > - using javareg.exe to register org.apache.fop.apps.Driver as
> > fop.apps.Driver
> > - creating a new ActiveXObject "fop.apps.Driver"
> > but object isn't created.
> >
> > Your help is much appreciated.
> > Tom
> >
> >
> >
>