You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by "Benoit, Frederick C." <FR...@saic.com> on 2010/10/20 20:29:46 UTC

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

 


RE: SVG in FOP 1.0

Posted by Jayant Ghagre <Ja...@ambest.com>.
Eric,

My servlet code is pretty much same as FopServlet.java file from src\java
\org\apache\fop\servlet folder.

I am attaching sample Xslt and XML data file.

One more thing, PDF generated using command line FOP has no issues.

(See attached file: SampleXSLT.xslt)(See attached file: Data.xml)(See
attached file: FopServlet.java)

Thanks.

Regards,
Jayant



|------------>
| From:      |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |"Eric Douglas" <ed...@blockhouse.com>                                                                                                          |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |<fo...@xmlgraphics.apache.org>                                                                                                                |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |01/11/2011 11:48 AM                                                                                                                               |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |RE: SVG in FOP 1.0                                                                                                                                |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|





I think we'd have to see some sample code to tell if jai is required or
if you're missing something else.
I know the FOP ant build has some optional tests based on whether jai is
available, and I do create SVG graphics in my normal processing where
jai is not in the classpath.


-----Original Message-----
From: Jayant Ghagre [mailto:Jayant.Ghagre@ambest.com]
Sent: Tuesday, January 11, 2011 11:41 AM
To: fop-users@xmlgraphics.apache.org
Subject: SVG in FOP 1.0

I am developing two web based prototypes for rendering PDF using XSL-FO.

First prototype is a Java Servlet deployed in Tomcat container in
windows environment. The servlet renders PDFs to web as well as windows
based clients. Everything works well, till I decided to add SVG elements
to generate 3D charts. I am using pre-compiled version of FOP 1.0.
Looking at the manifest file for FOP.jar, I noticed that jai_*.jar files
have not been referenced. If I include following jar files, I am able to
generate 3D graphs using SVG.

jai_codec.jar
jai_core.jar
jai_imageio.jar

Are these jar files sufficient for FOP to process SVG elements? I
thought that batik-all-1.7.jar should be sufficient to process SVG
elements. I guess I was wrong.

Second prototype is .NET based solution, where I have converted FOP 1.0
to a single .NET DLL using IKVM. Same issue here with SVG elements but
even if I include the jai_*.jar files in my .NET dll, still the SVG
elements are ignored.

There are issues mentioned with class loader functionality in the
following article. But this article was published in 2004, I bet there
have been considerable improvements in IKVM since then.

http://onjava.com/pub/a/onjava/2004/08/18/ikvm.html

================== Begin - Excerpt from the article Second is the ikvmc
command, which can be used to convert Java bytecodes into .NET IL. Thus,
you can convert a set of Java class files into a .NET assembly.

Since this manner of use statically compiles the Java bytecodes, it's
known as the static mode. Note that while the dynamic mode fully
supports the Java classloader semantics, in the static mode, there are
necessarily some limitations. Among the issues to watch out for is the
fact that all classes are loaded by the bootstrap classloader. See the
threads for the gory details. In brief, many Java programs assume
this.class.getClassLoader() will return non-null. That, however, is not
a valid assumption for classes loaded by the bootstrap loader.

Also, while classloader functionality (such as Class.forName(..)) is
available to use, and indeed can be used to load either statically
compiled classes or Java bytecode, remember that loading classes out of
.NET assemblies that are not referenced directly or indirectly from your
application may not work without manual intervention. See the
documentation for more detail on this and other hairy issues that arise
when two different worlds collide!
================== End - Excerpt from the article

I do understand that this is FOP user's email group, so IKVM related
issue may not be answered, but if anyone has experience using SVG
elements in .XSLT file, can point me to the right jar files (other than
mentioned above).



Thanks in advance for your help.



Regards,

Jayant




---------------------------------------------------------------------
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




RE: SVG in FOP 1.0

Posted by Eric Douglas <ed...@blockhouse.com>.
I think we'd have to see some sample code to tell if jai is required or
if you're missing something else.
I know the FOP ant build has some optional tests based on whether jai is
available, and I do create SVG graphics in my normal processing where
jai is not in the classpath.


-----Original Message-----
From: Jayant Ghagre [mailto:Jayant.Ghagre@ambest.com] 
Sent: Tuesday, January 11, 2011 11:41 AM
To: fop-users@xmlgraphics.apache.org
Subject: SVG in FOP 1.0

I am developing two web based prototypes for rendering PDF using XSL-FO.

First prototype is a Java Servlet deployed in Tomcat container in
windows environment. The servlet renders PDFs to web as well as windows
based clients. Everything works well, till I decided to add SVG elements
to generate 3D charts. I am using pre-compiled version of FOP 1.0.
Looking at the manifest file for FOP.jar, I noticed that jai_*.jar files
have not been referenced. If I include following jar files, I am able to
generate 3D graphs using SVG.

jai_codec.jar
jai_core.jar
jai_imageio.jar

Are these jar files sufficient for FOP to process SVG elements? I
thought that batik-all-1.7.jar should be sufficient to process SVG
elements. I guess I was wrong.

Second prototype is .NET based solution, where I have converted FOP 1.0
to a single .NET DLL using IKVM. Same issue here with SVG elements but
even if I include the jai_*.jar files in my .NET dll, still the SVG
elements are ignored.

There are issues mentioned with class loader functionality in the
following article. But this article was published in 2004, I bet there
have been considerable improvements in IKVM since then.

http://onjava.com/pub/a/onjava/2004/08/18/ikvm.html

================== Begin - Excerpt from the article Second is the ikvmc
command, which can be used to convert Java bytecodes into .NET IL. Thus,
you can convert a set of Java class files into a .NET assembly.

Since this manner of use statically compiles the Java bytecodes, it's
known as the static mode. Note that while the dynamic mode fully
supports the Java classloader semantics, in the static mode, there are
necessarily some limitations. Among the issues to watch out for is the
fact that all classes are loaded by the bootstrap classloader. See the
threads for the gory details. In brief, many Java programs assume
this.class.getClassLoader() will return non-null. That, however, is not
a valid assumption for classes loaded by the bootstrap loader.

Also, while classloader functionality (such as Class.forName(..)) is
available to use, and indeed can be used to load either statically
compiled classes or Java bytecode, remember that loading classes out of
.NET assemblies that are not referenced directly or indirectly from your
application may not work without manual intervention. See the
documentation for more detail on this and other hairy issues that arise
when two different worlds collide!
================== End - Excerpt from the article

I do understand that this is FOP user's email group, so IKVM related
issue may not be answered, but if anyone has experience using SVG
elements in .XSLT file, can point me to the right jar files (other than
mentioned above).



Thanks in advance for your help.



Regards,

Jayant




---------------------------------------------------------------------
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


SVG in FOP 1.0

Posted by Jayant Ghagre <Ja...@ambest.com>.
I am developing two web based prototypes for rendering PDF using XSL-FO.

First prototype is a Java Servlet deployed in Tomcat container in windows
environment. The servlet renders PDFs to web as well as windows based
clients. Everything works well, till I decided to add SVG elements to
generate 3D charts. I am using pre-compiled version of FOP 1.0. Looking at
the manifest file for FOP.jar, I noticed that jai_*.jar files have not been
referenced. If I include following jar files, I am able to generate 3D
graphs using SVG.

jai_codec.jar
jai_core.jar
jai_imageio.jar

Are these jar files sufficient for FOP to process SVG elements? I thought
that batik-all-1.7.jar should be sufficient to process SVG elements. I
guess I was wrong.

Second prototype is .NET based solution, where I have converted FOP 1.0 to
a single .NET DLL using IKVM. Same issue here with SVG elements but even if
I include the jai_*.jar files in my .NET dll, still the SVG elements are
ignored.

There are issues mentioned with class loader functionality in the following
article. But this article was published in 2004, I bet there have been
considerable improvements in IKVM since then.

http://onjava.com/pub/a/onjava/2004/08/18/ikvm.html

================== Begin - Excerpt from the article
Second is the ikvmc command, which can be used to convert Java bytecodes
into .NET IL. Thus, you can convert a set of Java class files into a .NET
assembly.

Since this manner of use statically compiles the Java bytecodes, it's known
as the static mode. Note that while the dynamic mode fully supports the
Java classloader semantics, in the static mode, there are necessarily some
limitations. Among the issues to watch out for is the fact that all classes
are loaded by the bootstrap classloader. See the threads for the gory
details. In brief, many Java programs assume this.class.getClassLoader()
will return non-null. That, however, is not a valid assumption for classes
loaded by the bootstrap loader.

Also, while classloader functionality (such as Class.forName(..)) is
available to use, and indeed can be used to load either statically compiled
classes or Java bytecode, remember that loading classes out of .NET
assemblies that are not referenced directly or indirectly from your
application may not work without manual intervention. See the documentation
for more detail on this and other hairy issues that arise when two
different worlds collide!
================== End - Excerpt from the article

I do understand that this is FOP user's email group, so IKVM related issue
may not be answered, but if anyone has experience using SVG elements
in .XSLT file, can point me to the right jar files (other than mentioned
above).



Thanks in advance for your help.



Regards,

Jayant




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


RE: ApacheFOP v1.0 and .NET

Posted by "Benoit, Frederick C." <FR...@saic.com>.
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." <FR...@saic.com>
|
 
>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|
|------------>
| To:        |
|------------>
 
>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|
  |<fo...@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." <FR...@saic.com>
|

>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|
|------------>
| To:        |
|------------>

>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|
  |<fo...@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


RE: ApacheFOP v1.0 and .NET

Posted by Jayant Ghagre <Ja...@ambest.com>.
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." <FR...@saic.com>                                                                                              |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |<fo...@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." <FR...@saic.com>
|

>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|
|------------>
| To:        |
|------------>

>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|
  |<fo...@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


RE: ApacheFOP v1.0 and .NET

Posted by "Benoit, Frederick C." <FR...@saic.com>.
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." <FR...@saic.com>
|
 
>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|
|------------>
| To:        |
|------------>
 
>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|
  |<fo...@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


Re: ApacheFOP v1.0 and .NET

Posted by Jayant Ghagre <Ja...@ambest.com>.
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." <FR...@saic.com>                                                                                              |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |<fo...@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