473,320 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Byte[] with PDF, how to stream to client, anyone know ? need some help.

Hello,

I have a bytearray with a pdf document inside. I whant to stream it to
the client (explorer IE) for download.
I just got the bytes writen on the screen , like

%PDF-1.4 %???? 10 0 obj<endobj xref 10 1627 0000000016 00000 n
0000035440 00000 n 0000032836 00000 n 0000035530 00000 n 0000035570
00000 n 0000035748 00000 n 0000059461 00000 n 0000071166 00000 n
0000083493 00000 n 0000096142 00000 n 0000109794 00000 n 0000125436
00000 n 0000132712 00000 n 0000139138 00000 n 0000152636
00000.........
My Code !
byte[] file = test.GetDocument("38GBRRHRA2QS8B7J");

Response.Clear();
Response.Buffer = false;

Response.ContentType = "Application/pdf";

Response.BinaryWrite(file);
Response.Flush();

Mar 29 '07 #1
2 1421
Something you may not be aware of is that if you were testing to screen
initially (i.e. not downloading), then change the code to download, your
download will still send to screen.

To get around this, you need to change your web address slightly. Just put a
? after the end of the address (or if you already have a ?, put an &)

This will ensure you are not getting it from cache. If you then use it
again, you might get the same issue, so what I usually do is something like
?test=1 then ?test=2 to ensure a clean address.

Hope this helps...

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
<je************@yahoo.sewrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
Hello,

I have a bytearray with a pdf document inside. I whant to stream it to
the client (explorer IE) for download.
I just got the bytes writen on the screen , like

%PDF-1.4 %???? 10 0 obj<endobj xref 10 1627 0000000016 00000 n
0000035440 00000 n 0000032836 00000 n 0000035530 00000 n 0000035570
00000 n 0000035748 00000 n 0000059461 00000 n 0000071166 00000 n
0000083493 00000 n 0000096142 00000 n 0000109794 00000 n 0000125436
00000 n 0000132712 00000 n 0000139138 00000 n 0000152636
00000.........
My Code !
byte[] file = test.GetDocument("38GBRRHRA2QS8B7J");

Response.Clear();
Response.Buffer = false;

Response.ContentType = "Application/pdf";

Response.BinaryWrite(file);
Response.Flush();

Mar 29 '07 #2


<je************@yahoo.sewrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
<snip>
My Code !
byte[] file = test.GetDocument("38GBRRHRA2QS8B7J");

Response.Clear();
Response.Buffer = false;

Response.ContentType = "Application/pdf";

Response.BinaryWrite(file);
Response.Flush();
</snip>
byte[] file = ...;

Response.AppendHeader("Content-Length", file.Length.ToString());
Response.AppendHeader("Content-Disposition",
"inline;filename=filename.pdf");
Response.ContentType = "Application/pdf";
Response.ClearContent();
Response.BufferOutput = true;

Response.BinaryWrite(file);
Response.Flush();
Response.End();
HTH,
Mythran
Mar 29 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nick | last post by:
I have found a class that compresses and uncompresses data but need some help with how to use part of it below is the deflate method which compresses the string that I pass in, this works OK. At...
0
by: vinothgsd | last post by:
Hi, I have created Client/Server application. In that Client side Program i have used Asynchronous Callback method for send and receive the stream. In the Receive method I want to make the...
10
by: Danny | last post by:
I am working on a project where I will receive xml documents from clients machines as a byte array. They will use the web browser navigate method to post the data to my ASP.NET page. I then pick up...
1
by: quddusaliquddus | last post by:
Hi :D, I am sending data to server via TCP IP Connection. I am using a continuous loop at the server end - that accepts new clients and while streams can be read, it reads data stream. ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.