xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benoit, Frederick C." <FREDERICK.C.BEN...@saic.com>
Subject RE: ApacheFOP v1.0 and .NET
Date Wed, 20 Oct 2010 19:32:56 GMT
Excellent!  This worked great.  Thank you.

Clay Benoit 
SAIC, Application Developer 
770-936-3650 (office)
770-845-2945 (cell)


-----Original Message-----
From:
fop-users-return-32920-FREDERICK.C.BENOIT=saic.com@xmlgraphics.apache.or
g
[mailto:fop-users-return-32920-FREDERICK.C.BENOIT=saic.com@xmlgraphics.a
pache.org] On Behalf Of Jayant Ghagre
Sent: Wednesday, October 20, 2010 3:19 PM
To: fop-users@xmlgraphics.apache.org
Cc: fop-users@xmlgraphics.apache.org
Subject: RE: ApacheFOP v1.0 and .NET

Clay,

Copy all jar files into a folder e.g. c:\Temp

Compile jar into DLL as follows
ikvmc -target:library -reference:IKVM.OpenJDK.Core.dll
-recurse:c:/Temp/*.jar -version:1.0 -out:c:/OutputFolderName/fop_1_0.dll

In your project, add reference to fop_1_0.dll and also to
IKVM.OpenJDK.*.DLL

I hope this helps. Btw, I was able to convert FOP 1.0 jars and use the
DLL
in VS 2008.


Regards,
Jayant



|------------>
| From:      |
|------------>
 
>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|
  |"Benoit, Frederick C." <FREDERICK.C.BENOIT@saic.com>
|
 
>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|
|------------>
| To:        |
|------------>
 
>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|
  |<fop-users@xmlgraphics.apache.org>
|
 
>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|
|------------>
| Date:      |
|------------>
 
>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|
  |10/20/2010 02:57 PM
|
 
>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|
|------------>
| Subject:   |
|------------>
 
>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|
  |RE: ApacheFOP v1.0 and .NET
|
 
>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|





Jayant,

Thanks for the response.  In order to leverage the 508 accessibility
features in FOP, I need to move to 1.0.  When I convert the JARs to DLLs
and reference them in my project, I cannot instantiate a FopFactory
object.

Clay

-----Original Message-----
From:
fop-users-return-32917-FREDERICK.C.BENOIT=saic.com@xmlgraphics.apache.or
g
[mailto:fop-users-return-32917-FREDERICK.C.BENOIT=saic.com@xmlgraphics.a
pache.org] On Behalf Of Jayant Ghagre
Sent: Wednesday, October 20, 2010 2:46 PM
To: fop-users@xmlgraphics.apache.org
Cc: fop-users@xmlgraphics.apache.org
Subject: Re: ApacheFOP v1.0 and .NET

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.BENOIT@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-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org







---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message