Rahul
Mon Jun 27 15:06:07 CDT 2005
Thanks Jon, that helps.
You have solved the first problem for me. I also need to open the pdf file
using the memory stream. How can I do that?
What is happening is that the calling program sends some xml text to the
called program which is then converted into some other xml format and sent
to the publishing tool, which then converts it into pdf file. The called
program poles to see if the pdf file has been created. Once available, it
creates a memory stream out of it and sends it to the calling program. The
calling programme now needs to use the memory stream and open it in acrobat,
for the user to see the same.
Thanks
Rahul
"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1d2a66e8cc6974fd98c3c0@msnews.microsoft.com...
> Rahul <aggarwal.rahul@myfloridahouse.com> wrote:
> > Problem Statement : I need to convert a pdf file on the file system into
a
> > filestream and then pass this stream to the calling program. Once the
steam
> > has been created I want to delete the file. The calling program then
needs
> > to use that stream and open pdf file.
> >
> > I know how to create the file stream. I cannot delete the file since
there
> > is a filestream that is open for that file. Do I have to convert it into
> > some other stream like Memory Stream? If yes, then how?
> >
> > Also how can the calling program use the stream to open the pdf file.
>
> Just to be clear, are there actually two *processes* involved in this,
> or is it really a caller within the same process?
>
> In either case, if you want to delete the file as soon as the client
> has started reading the data, you will indeed need to read it into
> something like a MemoryStream. The easiest thing would be to read the
> whole thing in (see
http://www.pobox.com/~skeet/csharp/readbinary.html
> for some sample code which can easily be adapted) and then reset the
> MemoryStream to the position 0.
>
> --
> Jon Skeet - <skeet@pobox.com>
>
http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too