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 Jayant Ghagre <Ja...@ambest.com> on 2011/01/11 17:41:09 UTC

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


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