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();
}
}
}
(Courtesy of the folks on the FOP Users Group)
Prerequisite: IKVM 0.44.0.5 installed.
C:\Fop\Build\
ikvmc -target:library -reference:IKVM.OpenJDK.Core.dll -recurse:C:\Fop\Build\\*.jar -version:1.0 -out:C:\Fop\fop.dll
fop.dll
,IKVM.OpenJDK.*.dll
andIKVM.Runtime.dll
ClatB`s worked here too. Just remmeber to add ALL IKVM libs to your project (Worked with Fop 1.1 and IKVM 7.2.4630.5).
I know this is an old thread but it still took some research to get this working. It is now available with NuGet in Visual Studio 2013. The NuGet package is called crispin.fop. In my code below, I pass in an "fop" file and the new PDF file I want created and "voila", it is created.
ClayB's worked for me. Please keep in mind point 2 "Copy all JAR files to C:\Fop\Build\".
"all" is very important. See here the list of jar's I needed:
- fop.jar
- avalon-framework-4.2.0.jar
- batik-all-1.7.jar
- commons-io-1.3.1.jar
- commons-logging-1.0.4.jar
- serializer-2.7.0.jar
- xalan-2.7.0.jar
- xercesImpl-2.7.1.jar
- xml-apis-1.3.04.jar
- xml-apis-ext-1.3.04.jar
- xmlgraphics-commons-1.4.jar
All the jar's other than fop you will find in folder "lib".
I tried the approach suggested by ClayB without any success.
I used the combinations of IKVM 0.44 and 0.46 with FOP 0.95 and 1.0. But nothing worked! There're some java libs are missing and causing errors. There's also an .net exception occured: could not load type in System.Security namespace. I even tried to compile each .jar file to a dll as suggested by Avik Sengupta at http://onjava.com/pub/a/onjava/2004/08/18/ikvm.html, but got stuck on lib\batik-all-1.7.jar. Unless anyone have got any further workrounds, I'm convinced this approach is no longer working with the latest kits.
However, I found a different approach which allows one to call FOP from .net. I hope this will help someone:
Please read the original article at: http://www.ptperalta.net/index.php/technology/using-apache-fop-in-net.html