Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP.Net ways of streaming pdf / word docs?

Reply
Thread Tools

ASP.Net ways of streaming pdf / word docs?

 
 
Jeff T
Guest
Posts: n/a
 
      03-20-2007
On Mar 20, 10:53 am, "Jim Bancroft" <(E-Mail Removed)> wrote:
> Hi everyone,
>
> We've have files we'd like to store in a SQL Server blob or text column and
> make available online for our clients. Instead of linking to a document
> sitting on a file server, we figure it'll be easier to manage the document
> store this way.
>
> Could someone point me to a tutorial or online docs on what classes .Net
> provides for streaming bytes (I assume that's what I'll be doing) from a
> database to a web browser and vice versa? Document upload will be the next
> step in the process.
>
> I'm guessing part of this will involve setting the http response headers.
> The best thing would be a pre-existing tutorial but any help is appreciated.
> Thanks!


Sounds like all you need to do is grab the binary data from the
database based on some sort of input and then send it to the browser.
You have the option to have the browser prompt the user to open/save
or just to have the browser open the document if it can within it's
window. (for example, IE can display Word docs).

So here is some sample C# code to send a file to the browser and have
it prompt the user to open/save it.

Response.ContentType = "application/excel";
Response.AddHeader("Content-Disposition", "attachment;
filename=" + nameFromTheDB);
Response.BinaryWrite(binaryDataFromTheDB);
Response.End();

 
Reply With Quote
 
 
 
 
Jim Bancroft
Guest
Posts: n/a
 
      03-20-2007
Hi everyone,

We've have files we'd like to store in a SQL Server blob or text column and
make available online for our clients. Instead of linking to a document
sitting on a file server, we figure it'll be easier to manage the document
store this way.

Could someone point me to a tutorial or online docs on what classes .Net
provides for streaming bytes (I assume that's what I'll be doing) from a
database to a web browser and vice versa? Document upload will be the next
step in the process.

I'm guessing part of this will involve setting the http response headers.
The best thing would be a pre-existing tutorial but any help is appreciated.
Thanks!


 
Reply With Quote
 
 
 
 
Jim Bancroft
Guest
Posts: n/a
 
      03-20-2007
Looks great. Thanks!

> So here is some sample C# code to send a file to the browser and have
> it prompt the user to open/save it.
>
> Response.ContentType = "application/excel";
> Response.AddHeader("Content-Disposition", "attachment;
> filename=" + nameFromTheDB);
> Response.BinaryWrite(binaryDataFromTheDB);
> Response.End();
>



 
Reply With Quote
 
Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
Guest
Posts: n/a
 
      03-21-2007
Yes, this article explains how to upload binary files into your SQL Server
database and how to stream them back out again. And yes it does cover byte
streaming.

http://SteveOrr.net/articles/EasyUploads.aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net


"Jim Bancroft" <(E-Mail Removed)> wrote in message
news:e%(E-Mail Removed)...
> Hi everyone,
>
> We've have files we'd like to store in a SQL Server blob or text column
> and make available online for our clients. Instead of linking to a
> document sitting on a file server, we figure it'll be easier to manage the
> document store this way.
>
> Could someone point me to a tutorial or online docs on what classes .Net
> provides for streaming bytes (I assume that's what I'll be doing) from a
> database to a web browser and vice versa? Document upload will be the
> next step in the process.
>
> I'm guessing part of this will involve setting the http response headers.
> The best thing would be a pre-existing tutorial but any help is
> appreciated. Thanks!
>
>


 
Reply With Quote
 
=?Utf-8?B?UGVuIEp1YW4=?=
Guest
Posts: n/a
 
      04-09-2007
Steve,
Can you provide your excellent article in EasyUploads in C# too?
Thank you.
--
Pen


"Steve C. Orr [MCSD, MVP, CSM, ASP Inside" wrote:

> Yes, this article explains how to upload binary files into your SQL Server
> database and how to stream them back out again. And yes it does cover byte
> streaming.
>
> http://SteveOrr.net/articles/EasyUploads.aspx
>
> --
> I hope this helps,
> Steve C. Orr,
> MCSD, MVP, CSM, ASPInsider
> http://SteveOrr.net
>
>
> "Jim Bancroft" <(E-Mail Removed)> wrote in message
> news:e%(E-Mail Removed)...
> > Hi everyone,
> >
> > We've have files we'd like to store in a SQL Server blob or text column
> > and make available online for our clients. Instead of linking to a
> > document sitting on a file server, we figure it'll be easier to manage the
> > document store this way.
> >
> > Could someone point me to a tutorial or online docs on what classes .Net
> > provides for streaming bytes (I assume that's what I'll be doing) from a
> > database to a web browser and vice versa? Document upload will be the
> > next step in the process.
> >
> > I'm guessing part of this will involve setting the http response headers.
> > The best thing would be a pre-existing tutorial but any help is
> > appreciated. Thanks!
> >
> >

>
>

 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      04-09-2007
"Pen Juan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> Can you provide your excellent article in EasyUploads in C# too?


Why don't you just convert it...?


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Library to parse MS word docs & convert Word docs to PDF KYG C++ 2 08-18-2008 07:08 PM
Postscript to PDF with pdf-tools, pdf-writer, or other Sean Nakasone Ruby 1 04-14-2008 09:13 PM
PDF::Writer, create pdf and insert in other pdf file. Ricardo Pog Ruby 1 03-26-2008 08:24 PM
XML from Word -- formerly Create pdf from existing Word doc (asp.net) Sharon ASP .Net 0 07-27-2005 02:07 AM



Advertisments