stream/pdf/email

  • Thread starter Thread starter Peter Kirk
  • Start date Start date
P

Peter Kirk

Hi there

In a web app I am making, I use a class which has a method which generates a
pdf from some xml data. The method accepts a "stream" parameter which I set
to the http-output-stream, and thereby the pdf is sent automatically to the
user's browser.

This has worked fine, but now there are some changes required.

Instead of streaming the pdf to the user's browser I need to include the pdf
in an email instead. Actually I need to send multiple emails with the same
pdf. What is a good way of doing this? What type of "output stream" can I
instantiate and send to the pdf-generation method, and include in multiple
emails?

Thanks for any advice,
Peter
 
Hi, thanks.

Actually I found a solution where I use a MemoryStream (wrapped in a
BufferedStream). It also took me a while to realise there are two "email"
components in .net - with the .net2 System.Net.Mail seemingly much more
versatile.

Is a MemoryStream/BufferedStream ok for this - or are there advantages with
a FileStream?

Thanks,
Peter
 
Why you want to use a BufferedStream ontop of a memoryStream?

--
William Stacey [MVP]

| Hi, thanks.
|
| Actually I found a solution where I use a MemoryStream (wrapped in a
| BufferedStream). It also took me a while to realise there are two "email"
| components in .net - with the .net2 System.Net.Mail seemingly much more
| versatile.
|
| Is a MemoryStream/BufferedStream ok for this - or are there advantages
with
| a FileStream?
|
| Thanks,
| Peter
|
| "Greg Young" <[email protected]> skrev i en meddelelse
| | >A filestream .. then include the file as an attachment to the emails.
| >
| > Cheers,
| >
| > Greg
| > | >> Hi there
| >>
| >> In a web app I am making, I use a class which has a method which
| >> generates a pdf from some xml data. The method accepts a "stream"
| >> parameter which I set to the http-output-stream, and thereby the pdf is
| >> sent automatically to the user's browser.
| >>
| >> This has worked fine, but now there are some changes required.
| >>
| >> Instead of streaming the pdf to the user's browser I need to include
the
| >> pdf in an email instead. Actually I need to send multiple emails with
the
| >> same pdf. What is a good way of doing this? What type of "output
stream"
| >> can I instantiate and send to the pdf-generation method, and include in
| >> multiple emails?
| >>
| >> Thanks for any advice,
| >> Peter
| >>
| >
| >
|
|
 
A memorystream also works ... I assumed filestream from your previous
description.

You should not have to wrap it in a bufferredstream though you should just
be able to use the memroystream directly.
 
OK, thanks,

I have no clear reason why I wrapped the MemoryStream in a BufferedStream.
Probably a mix of blindly believing if it says "buffered" it must be better
than one which doesn't say "buffered", and of trying all sorts of types of
streams with the pdf generator and emails until I got something that worked,
and then trying to untwine the mess to something that still worked but
looked more elegant....

cheers,
Peter
 
Back
Top