RE: Using FOP from ASP
Of course - this is purely a quick fix. Good luck with your COM wrangling. I'm sure a lot of people would be interested in that. -David On Fri, 1 Mar 2002 [EMAIL PROTECTED] wrote: > David wrote: > ... > >ResultCode = Shell.Run(commandline,,True) ' True = Wait for FOP to finish > > If you use this method for a whole batch of transformations it's going to be > inefficient because none of the objects get re-used. > My latest plan is to write a small java class that will tranform a list of > fo files using the same driver & renderer objects. It might even be possible > to register this class as a COM object, which would be great. If it works & > if you're interested... > > Regards, > Tom >
RE: Using FOP from ASP
David wrote: ... >ResultCode = Shell.Run(commandline,,True) ' True = Wait for FOP to finish If you use this method for a whole batch of transformations it's going to be inefficient because none of the objects get re-used. My latest plan is to write a small java class that will tranform a list of fo files using the same driver & renderer objects. It might even be possible to register this class as a COM object, which would be great. If it works & if you're interested... Regards, Tom
Re: Using FOP from ASP
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 [EMAIL PROTECTED] 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 > > > > > > >
Re: Using FOP from ASP
On Thursday 28 February 2002 17:26, [EMAIL PROTECTED] wrote: > Bertrand wrote: > >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: > > That sounds a much saner way of doing things, although I don't know > much java :-& You don't need to know java to configure Cocoon with FOP: it's out of the box in the standard installation, if you get Cocoon to run you're in business and you have a dynamic HTTP-to-PDF server which can take a lot of different data sources as input. Then, to configure Cocoon you will need to understand the sitemap concept, it's not that hard for simple things, and it's XML-based, no programming needed. The skills you will need to get Cocoon running are more in the area of "life at the command-line", configuring stuff through XML files and using text-based log files to troubleshoot your installation. >. . . > The trouble is every month or so we have to print out the whole bunch > (about 600) of the things to post off to clients, which is why I need > a sturdy batch process. Existing examples of Cocoon sites show that it is ready for production. Depending on the complexity of your documents, FOP's memory requirements might get in the way, but that's a problem you will have anyway. Cocoon also has a command-line mode which I do not know well, but I think could allow you to generate your PDF docs to files directly. 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
Bertrand wrote: >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: That sounds a much saner way of doing things, although I don't know much java :-& In fact I was contemplating it anyway as a means of giving users access to the pdf documents on demand. The trouble is every month or so we have to print out the whole bunch (about 600) of the things to post off to clients, which is why I need a sturdy batch process. thanks for your help Tom
Re: Using FOP from ASP
On Thursday 28 February 2002 16:58, [EMAIL PROTECTED] 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.