• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Determine PNG image start/end in a Fop stream.

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I use Apache FOP to generate PDFs and PNGs from given xml content (content.xml) and xsl markup (markup.xsl).
If there is a long content.xml file it perfectly generates e.g. 3-page PDF and 3 different PNG files.
There is no problems if I store it on filesystem.

But if I want the PNG to be printed out directly in a Servlet output stream it gives only the first file.



The getImageStream method is only makes transformation and returns the output stream which contains 3 PNG files:


Is there any way to force it to give all three PNG files?

I don't want to store temporary files on server, is there any way to do it just writing the Fop outputstream content into Servlet response output stream?

Thank you.
 
Sheriff
Posts: 27525
88
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't quite understand your description of the data. But I have to say that the idea of sending three concatenated PNG files as the response to an HTTP request is a bad idea. Whatever sent the request is expecting a single file as the response. A single PDF file which contains three embedded images would be fine; a PNG image would also be fine. But three images lumped together is not fine.
 
Eugene Smola
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Agree. That's why it is not working, I think.

But is that possible to determine in the Fop output stream where the first PNG stops and second starts and do e.g. download button for each? As what Fop gives is the only output stream where three PNGs hidden.
 
Ranch Hand
Posts: 734
7
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One possible way to do, asking for less trouble, is to form the output image in tiff (mime "image/tiff") all in one piece.
 
Eugene Smola
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you. That sounds like the most appropriate way of doing so.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic