________________________
> Date: Mon, 22 Feb 2010 11:45:43 +0100
> From:
> To: itext-questions@lists.sourceforge.net
> Subject: [iText-questions] Writing to ServletOutputStream
>
> Hi,
>
> Please note that I postet links to pastie.org for better readability of the 
> code snippets.
>
> I am using iText to print graphs produced with the JUNG Framework to pdfs.
> To achieve this I have the following code:
>
>
> http://www.pastie.org/private/rsy6wzneedpvo4dai3vcgw
>
> Writing the graphics Object to the pdf is done by the following code:
>
> http://www.pastie.org/private/zgwocpvjih16j2cmcdmza
>
>
> The produced ByteArrayOutputStream is used to save the content to a file 
> (works great - I get a wonderful pdf):
>
> http://www.pastie.org/private/imxi9cmdrzowop9ivxgnba
>
>
> The reason why I am generating a ByteArrayOutputStream is that I additionally 
> want to write the created pdf content to a ServletOutputStream:
>
> http://www.pastie.org/private/r4h2lad26xbwjokoh0zbq
>
>
> unfortunately the only thing I get is a PDF document in the desired dimension 
> but blank - no content :( I am using almost the same code for writing text 
> content to a ServletOutputStream and I do get the content - so I think the 
> code of the response is ok. Is there a problem of writing 
> ByteArrayOutputStream content containing iText data to ServletOutputStreams? 
> It is really weird that everything works when I write the 
> ByteArrayOutputStream content to a FileOutputStream and don't get anything 
> when I write it to the ServletOutputStream :(
>


I didn't hit the links and I'm not sure what you mean by blank but do you set 
the server's content type to
something telling your browser it is pdf? If you hit your server with something 
more diagnostic than artistic,
like wget instead of IE, you can at least see what it thinks is going on- is 
the byte count right etc. You may
even be able to do some diffs and determine if there is truncation or 
corruption etc. Also check the servlet
debugging information which you hopefully generate :)





>
> It would be great if you could take a look at my code.
>
> Thank you in advance!
>
> Sebastian Furth
>
                                          
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/201469230/direct/01/
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to