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 "Burlock, Craig (SAPOL)" <Cr...@police.sa.gov.au> on 2005/02/21 03:43:40 UTC
RE: URGENT - Adding dynamic, non file system images into a pdf do
cume nt.
Jeremias, thank you so much for your help.
I've included the java files within my project and have specified the change
to the jvm. I added some System.out.println traces into both files, but
they just don't seem to run from within the cocoon-2.0.4 sitemap when
serialization occurs.
Everything that you suggested seems spot-on to me, but the pdf files still
serialize huge and the handler doesn't seem to get a chance to do its thing.
I may have done something wrong, but I don't think so... I am unsure what
else to try. Do you know if perhaps a change needs to be made to my
serializer configuration to force the use of the replacement protocol?
<map:serializer name="fo2pdf"
src="org.apache.cocoon.serialization.FOPSerializer"
logger="sitemap.serializer.fo2pdf"
mime-type="application/pdf">
<user-config>fop-config.xml</user-config>
</map:serializer>
Any thoughts will be greatly appreciated.
Craig Burlock.
-----Original Message-----
From: Jeremias Maerki [mailto:dev.jeremias@greenmail.ch]
Sent: Saturday, 19 February 2005 6:26 AM
To: fop-user@xml.apache.org
Subject: Re: URGENT - Adding dynamic, non file system images into a pdf
docume nt.
Craig,
I've just come back from the lots.ch conference today and I had some
time in the train to write that protocol handler I was talking about
(for the data: protocol). Find the sources here:
http://cvs.apache.org/~jeremias/datahandler.zip
To make it work you have to put them somewhere in your project (or in
FOP and recompile) and specify the following system property for the
virtual machine:
-Djava.protocol.handler.pkgs=org.apache.fop.util.protocols
Adjust accordingly if you change the package names. The implementations
defers to Batik's implementation of RFC2397 as I hinted would be
possible.
On 17.02.2005 06:14:27 Burlock, Craig (SAPOL) wrote:
> I'm trying to produce a pdf document that contains dynamically generated
> jpeg images. The images are available within the session. I'm using a
> cocoon pipline match to serialise xsl-fo into pdf documents.
>
> I've explored the following options:
>
> 1.) Creating a cocoon servlet to stream back the image data. This work
fine
> for images within HTML document. When I reference the servlet from an
> xsl-fo image source, my session is unavailable and only a new session
> accessible.
>
> 2.) Create a cocoon generator to turn jpeg image binary into a base64
> encoded string and embed this string within an instream-foreign-object
using
> svg. This method produces visible images, but the final pdf document is
> huge. It's like the jpeg compression is being translated into an
> uncompressed bitmap.
>
> <fo:instream-foreign-object content-type="content-type:image/jpeg">
> <svg:svg height="176mm" width="277mm">
> <svg:image width="277mm" height="176mm" x="0" y="0"
> xlink:href="data:image/jpeg;base64, /9j/4AAQSkZJRgABAQAAAQAgLCgoL . . . ."
> />
> </svg:svg>
> </fo:instream-foreign-object>
>
> I've already spent too much time trying to get this working. I've found
> some references to this type of issue in other mail archives, but the
> responses I've seen have been very vague. I'll be forced to drop using
pdf
> reports and use ugly html if I can't resolve this very soon.
>
> If anyone has a solution that they have tried, please let me know. I'd
hate
> to abandon fop and produce nasty html reports after getting this far!
>
> Please help
>
> Craig.
Jeremias Maerki
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: URGENT - Adding dynamic, non file system images into a pdf do cume nt.
Posted by Jeremias Maerki <de...@greenmail.ch>.
Sounds like a class loader problem. I didn't think about you're using
Cocoon which is complicating things a bit. I think the protocol handler
is not found by the JDK because your JAR is in a custom class loader
created by Cocoon. So we must ensure that the classes are available
higher up in the hierarchy.
The following should work:
1. Put the two new classes in their own ZIP.
2. Copy this ZIP to Cocoon's endorsed directory.
3. Move batik.jar from Cocoon's lib/optional dir to Cocoon's endorsed
directory.
That's if you're starting Cocoon from the command-line. If you embed it
in Tomcat for example, you should put the two JARs in to Tomcat's
common/endorsed directory.
You could also put it in your JDK's jre/lib/endorsed directory.
Sorry, if this may be a bit complicated but it's the easiest/quickest way
to make sure that the protocol handler is available to java.net.URL.
On 21.02.2005 03:43:40 Burlock, Craig (SAPOL) wrote:
> Jeremias, thank you so much for your help.
>
> I've included the java files within my project and have specified the change
> to the jvm. I added some System.out.println traces into both files, but
> they just don't seem to run from within the cocoon-2.0.4 sitemap when
> serialization occurs.
>
> Everything that you suggested seems spot-on to me, but the pdf files still
> serialize huge and the handler doesn't seem to get a chance to do its thing.
>
> I may have done something wrong, but I don't think so... I am unsure what
> else to try. Do you know if perhaps a change needs to be made to my
> serializer configuration to force the use of the replacement protocol?
>
> <map:serializer name="fo2pdf"
> src="org.apache.cocoon.serialization.FOPSerializer"
> logger="sitemap.serializer.fo2pdf"
> mime-type="application/pdf">
> <user-config>fop-config.xml</user-config>
> </map:serializer>
>
> Any thoughts will be greatly appreciated.
Jeremias Maerki
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org