Using ApacheFOP v1.0 in .NET application

Clay Benoit picture Clay Benoit · Oct 18, 2010 · Viewed 10.2k times · Source

Has anyone successfully complied the Apache FOP v1.0 library to a .NET DLL? I am using the IKVM syntax found at http://onjava.com/pub/a/onjava/2004/08/18/ikvm.html; however, the compiled DLL seems to be incomplete. For example, I cannot instantiate FopFactory object as:

using org.apache.fop.apps;

namespace Utils
{
     public class PdfRender
     {
          public void Render()
          {
            FOUserAgent foUserAgent = fop.getUserAgent();
            FopFactory fopFactory = FopFactory.newInstance();
          }
     }
}

Answer

Clay Benoit picture Clay Benoit · Oct 25, 2010

(Courtesy of the folks on the FOP Users Group)

Prerequisite: IKVM 0.44.0.5 installed.

  1. Download FOP 1.0 from http://xmlgraphics.apache.org/fop/1.0/index.html#download
  2. Copy all JAR files to C:\Fop\Build\
  3. Open a command prompt and run the following: ikvmc -target:library -reference:IKVM.OpenJDK.Core.dll -recurse:C:\Fop\Build\\*.jar -version:1.0 -out:C:\Fop\fop.dll
  4. In your Visual Studio project, add references to fop.dll, IKVM.OpenJDK.*.dll and IKVM.Runtime.dll