I worked on this for some time earlier today (with a lot of help from 
others) and have gotten all of the issues resolved. I now understand how 
to make it work reliably with HttpResponse stream, FileStreams and 
MemoryStreams.

The only part that was an iText issues is that in the .NET version of 
the PdfWriter, the stream is closed when the document is closed unless 
you obtain a reference to the PdfWriter and set the CloseStream property 
to false. This property (I think) does not exist in the java version and 
is not mentioned in the book.

Not knowing this, I spent a lot of time trying to do things to a stream 
that I thought was open when it had actually been closed.

Hopefully that's all behind me now.

Thanks for your comments,
Dan

robert engels wrote:
> I don't think your problem has anything to do with itext,
> 
> It is a misunderstanding on how to use a Response stream.
> 
> i think if you created a simple memory stream of a text file, you  
> would have the same problem.
> 
> You need to ask these questions on a M$ .Net web programming site.
> 
> 
> 
> On Dec 30, 2006, at 2:07 AM, Daniel Essin wrote:
> 
>> There was an example in the iText in Action book that demonstrated  
>> doing
>> it this way. I am just trying to get a full understanding of how the
>> methods work before I start real coding. I understand the potential
>> inefficiency of feeding this through a memory stream and I doubt  
>> that I
>> would actually use it, but I don't feel comfortable with new  
>> components
>> until I have fully exercised them and understand all the options.
>>
>> Dan
>>
>> robert engels wrote:
>>> You are best to supply PdfWriter with the Response.OutputStream
>>> anyway, otherwise you need to buffer the entire PDF in memory.
>>>
>>> Why do you want to do this?
>>>
>>> On Dec 29, 2006, at 5:40 PM, Daniel Essin wrote:
>>>
>>>> It's not different English, it's just a snapshot into the evolving
>>>> state
>>>> of my confusion.
>>>>
>>>> My original post was confused because I was confused. I was  
>>>> reading a
>>>> hex dump of the stream buffer and I did 2 things that were both  
>>>> wrong:
>>>> - I misinterpreted the first character in the buffer as a 7  
>>>> instead of
>>>> what it was, a %
>>>> - I assumed that the buffer was reaching acrobat via the web page
>>>> which
>>>> it is apparently not.
>>>>
>>>> Since then I have tried every permutation that I can think of and
>>>> ended
>>>> up thus - I can generate and send a page by supplying PdfWriter
>>>> with the
>>>> Response.OutputStream, I can write a valid pdf file by supplying
>>>> PdfWriter with an open FileStream but if I try to supply PdfWriter
>>>> with
>>>> a MemoryStream and then try to feed the MemoryStream to the
>>>> HttpResponse
>>>> object I get 0 bytes transmitted but since the response nas the
>>>> ContentType set to "application/pdf", Acrobat generates an error
>>>> message
>>>> upon being invoked with no bytes in the stream.
>>>>
>>>> I don't know why, and I don't know how to fix it. That's why I have
>>>> been
>>>> pestering this thread.
>>>>
>>>> I appreciate your taking the time to respond.
>>>>
>>>> Any bright ideas or correction of my limited understanding of this
>>>> subject would be greatly appreciated,
>>>> Dan
>>>>
>>>> robert engels wrote:
>>>>> We must be using different english...
>>>>>
>>>>> On Dec 29, 2006, at 5:14 PM, Daniel Essin wrote:
>>>>>
>>>>>>>>>> OK let me start over again. I was reading the dump incorrectly
>>>>>>>>>>
>>>>>>>>>> and the
>>>>>>>>>>
>>>>>>>>>> first byte is a %
>>>>>>>>>>
>>>>> ------------------------------------------------------------------- 
>>>>> --
>>>>> ---
>>>>>
>>>>> ------------------------------------------------------------------- 
>>>>> --
>>>>> ----
>>>>> Take Surveys. Earn Cash. Influence the Future of IT
>>>>> Join SourceForge.net's Techsay panel and you'll get the chance to
>>>>> share your
>>>>> opinions on IT & business topics through brief surveys - and earn
>>>>> cash
>>>>> http://www.techsay.com/default.php?
>>>>> page=join.php&p=sourceforge&CID=DEVDEV
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------- 
>>>>> --
>>>>> ---
>>>>>
>>>>> _______________________________________________
>>>>> iText-questions mailing list
>>>>> iText-questions@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>>>> Buy the iText book: http://itext.ugent.be/itext-in-action/
>>>> -------------------------------------------------------------------- 
>>>> --
>>>> ---
>>>> Take Surveys. Earn Cash. Influence the Future of IT
>>>> Join SourceForge.net's Techsay panel and you'll get the chance to
>>>> share your
>>>> opinions on IT & business topics through brief surveys - and earn  
>>>> cash
>>>> http://www.techsay.com/default.php?
>>>> page=join.php&p=sourceforge&CID=DEVDEV
>>>> _______________________________________________
>>>> iText-questions mailing list
>>>> iText-questions@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>>> Buy the iText book: http://itext.ugent.be/itext-in-action/
>>>
>>> --------------------------------------------------------------------- 
>>> ----
>>> Take Surveys. Earn Cash. Influence the Future of IT
>>> Join SourceForge.net's Techsay panel and you'll get the chance to  
>>> share your
>>> opinions on IT & business topics through brief surveys - and earn  
>>> cash
>>> http://www.techsay.com/default.php? 
>>> page=join.php&p=sourceforge&CID=DEVDEV
>>> _______________________________________________
>>> iText-questions mailing list
>>> iText-questions@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>> Buy the iText book: http://itext.ugent.be/itext-in-action/
>>>
>>
>> ---------------------------------------------------------------------- 
>> ---
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to  
>> share your
>> opinions on IT & business topics through brief surveys - and earn cash
>> http://www.techsay.com/default.php? 
>> page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> iText-questions mailing list
>> iText-questions@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>> Buy the iText book: http://itext.ugent.be/itext-in-action/
> 
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
> 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to