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/17 06:14:27 UTC

URGENT - Adding dynamic, non file system images into a pdf docume nt.

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.

Re: URGENT - Adding dynamic, non file system images into a pdf docume nt.

Posted by Jeremias Maerki <de...@greenmail.ch>.
So my answer [1] didn't help? You could have said so earlier. What were
your problems with my proposal? What you need just doesn't exist in FOP.
The protocol handler is something that might be found somewhere else but
can then be used inside of FOP. I've once started to write such a
protocol handler but it's nowhere near finished. I'm sure this approach
will work but it'll take some effort.

[1] http://marc.theaimsgroup.com/?l=fop-user&m=110810769119382&w=2

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


Re: URGENT - Adding dynamic, non file system images into a pdf docume nt.

Posted by Jeremias Maerki <de...@greenmail.ch>.
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


Re: URGENT - Adding dynamic, non file system images into a pdf docume nt.

Posted by David Causse <dc...@cognitis.fr>.
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 .
>
I had the same problem, for different purpose (we need to pass a lot of 
data to cocoon and GET is to much limited and POST is not yet supported 
by map:action request). So we had to invent a workaround.
I created a sort of cache class that contains the data accessible via a 
singleton class (.getInstance()).
Session problem is no more a problem (except if you have stranger 
filters), just load into the cache your jpeg stream and affect an ID
and create a servlet that serve the stream from cache and not the 
session from the ID passed via the request.
It's like creating a master session serving generic data to everyone if 
it has the proper generated ID.
After you have to think about how and when you clean the cache, it is up 
to you.

Hope it helps.

David.

> 2.) Create a cocoon generator to turn jpeg image binary into a b|ase64 
> 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;b|ase64, /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 a rchives, 
> 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.
>


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