Clay, I was able to convert FOP 0.95 JAR files to .NET DLL using IKVM 0.42.0.6.
Here's the sample code (VB.BET). You'll need a windows form with a button object on it to test this code. ======================== Begin sample code '--- Java Imports java.io.File Imports java.io.OutputStream '--- JAXP Imports javax.xml.transform.Transformer Imports javax.xml.transform.TransformerFactory Imports javax.xml.transform.sax.SAXSource Imports javax.xml.transform.sax.SAXResult Imports javax.xml.transform.stream.StreamSource '--- FOP Imports org.apache.fop.apps.FOUserAgent Imports org.apache.fop.apps.Fop Imports org.apache.fop.apps.FopFactory Public Class Form1 Private Sub btnViewReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnViewReport.Click Dim sourceDataFile As String = "XML_Data_File_Name.xml" Dim sourceTemplateFile As String = "Style_Sheet_File_Name.xsl" Dim sourceConfigFile As String = "cfg.xml" Dim outputFile As String = "Output_PDF_File_Name.pdf" Dim blnResult As Boolean = False blnResult = CreateReport(sourceDataFile, sourceTemplateFile, sourceConfigFile, outputFile) If blnResult Then Process.Start(outputFile) End If End Sub Public Function CreateReport( _ ByVal sourceDataFile As String, _ ByVal sourceTemplateFile As String, _ ByVal sourceConfigFile As String, _ ByVal outputFile As String) As Boolean Dim xmlFile As New java.io.File(sourceDataFile) Dim xsltFile As New java.io.File(sourceTemplateFile) Dim pdfFile As New java.io.File(outputFile) Dim myfopFactory As org.apache.fop.apps.FopFactory myfopFactory = org.apache.fop.apps.FopFactory.newInstance() myfopFactory.setUserConfig(New java.io.File(sourceConfigFile)) Dim myFOUserAgent As org.apache.fop.apps.FOUserAgent myFOUserAgent = myfopFactory.newFOUserAgent Dim myoutputStream As java.io.OutputStream = New java.io.FileOutputStream(pdfFile) myoutputStream = New java.io.BufferedOutputStream(myoutputStream) Try Dim myFop As org.apache.fop.apps.Fop = myfopFactory.newFop (org.apache.fop.apps.MimeConstants.MIME_PDF, myFOUserAgent, myoutputStream) Dim mytransformerFactory As javax.xml.transform.TransformerFactory = javax.xml.transform.TransformerFactory.newInstance() Dim myTransformer As javax.xml.transform.Transformer = mytransformerFactory.newTransformer(New javax.xml.transform.stream.StreamSource(xsltFile)) Dim mySourceData As javax.xml.transform.stream.StreamSource = New javax.xml.transform.stream.StreamSource(xmlFile) Dim myResults As javax.xml.transform.sax.SAXResult = New javax.xml.transform.sax.SAXResult(myFop.getDefaultHandler) myTransformer.transform(mySourceData, myResults) Catch ex As Exception myoutputStream.close() MsgBox(ex.Message) Return False Finally myoutputStream.close() End Try Return True End Function End Class =============== End sample code Regards, Jayant |------------> | From: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |"Benoit, Frederick C." <frederick.c.ben...@saic.com> | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | To: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |<fop-users@xmlgraphics.apache.org> | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Date: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |10/20/2010 02:27 PM | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Subject: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |ApacheFOP v1.0 and .NET | >--------------------------------------------------------------------------------------------------------------------------------------------------| Has anyone successfully complied the Apache FOP v1.0 library to a .NET DLL? I am using IKVM 0.44.0.5 and attempted to translate the command line syntax in http://onjava.com/pub/a/onjava/2004/08/18/ikvm.html. I have also tried to compile each JAR to a DLL referencing the IVKM.OpenDK.*.dll. The dlls are generated, but once I add them to my .NET project, I do not have access to the FopFactory class or other classes documented in the Apache FOP library. Clay --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org