473,378 Members | 1,426 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,378 software developers and data experts.

Streaming PDF to IE 6.0 browser

Hi all misters,

I hope someone can help me here.

Here is my problem.

I stream the PDF files to the browser because they contain private
information and they are not located within the web site itself. The
application opens the PDF file and then streams it to the browser. I call to
ASPX page like this: ShowFile.aspx?IDFILE=100&NAME=000040.pdf.

The aspx page calls WCF service and gets all bytes of a PDF file.

When streams bytes of PDF file to browser, Acrobat Reader OCX reads bytes
and shows PDF, the user can save PDF to disk file with a name.

I want that the filename could be the NAME querystring parameter.

I try but doesn't works fine.

Here is the code that I use:

Thanks for any help you can offer, thanks in advance, any help will be very
grateful, regards, greetings

Response.Buffer = True '//<<- Va con el Response.Flush();

'Response.BufferOutput = True

Response.Clear()

Response.ClearContent()

Response.ClearHeaders()

'Response.CacheControl = "Private" 'Public

Response.AddHeader("Accept-Header", tamanoFichero.ToString())

Response.AddHeader("Content-Size", tamanoFichero.ToString())

Response.AddHeader("Content-Length", tamanoFichero.ToString())

Dim abrirEnAcrobatReader As Boolean = False

If abrirEnAcrobatReader Then

' AparecerÃ*a un cuadro de diálogo para Abrir o Guardar fichero

Response.AddHeader("Content-Disposition", "attachment; filename=" +
Path.GetFileName(nombreFichero))

Else

Response.AddHeader("Content-Disposition", "inline;filename=" + nombreFichero)

End If

'Response.AddHeader("Content-Disposition", "attachment; filename=" & fn)

'Response.AddHeader("Content-Disposition", "attachment; filename=" & fn & ";")

'Response.AddHeader("Content-Disposition", "inline; filename=" & fn)

'Response.AddHeader("Content-Disposition", "inline; filename=" & fn & ";")

'Response.AddHeader("Content-Disposition", "filename=" & fn)

'Response.AddHeader("Content-Disposition", "filename=" & fn & ";")

Response.AddHeader("Expires", "0")

Response.AddHeader("Pragma", "cache")

Response.AddHeader("Cache-Control", "private")

'//Set the output stream to the correct content type (PDF).

Response.ContentType = sMimeType

'Response.AddHeader("Content-Type", sMimeType)

Response.AddHeader("Accept-Ranges", "bytes")

Response.Charset = ""

Response.BinaryWrite(infoFichero.ContenidoFichero)

Response.Flush()

'Response.WriteFile(fichero)

'Response.Close()

Response.End()

--
http://www.alhambra-eidos.es/web2005/index.html
www.kiquenet.net
http://www.setbb.com/putainformatica...opic.php?p=843
www.trabajobasura.com/solusoft

Jul 8 '08 #1
3 1870
On Jul 8, 3:03*pm, Alhambra Eidos Kiquenet
<AlhambraEidosKique...@discussions.microsoft.comwr ote:
Hi all misters,

I hope someone can help me here.

Here is my problem. *

I stream the PDF files to the browser because they contain private
information and they are not located within the web site itself. *The
application opens the PDF file and then streams it to the browser. *I call to
ASPX page like this: ShowFile.aspx?IDFILE=100&NAME=000040.pdf.

The aspx page calls WCF service and gets all bytes of a PDF file.

When streams bytes of PDF file to browser, Acrobat Reader OCX reads bytes
and shows PDF, the user can save PDF to disk file with a name.

I want that the filename could be the NAME querystring parameter.

I try but doesn't works fine.

Here is the code that I use:

Thanks for any help you can offer, thanks in advance, any help will be very
grateful, regards, greetings

Response.Buffer = True '//<<- Va con el Response.Flush();

'Response.BufferOutput = True

Response.Clear()

Response.ClearContent()

Response.ClearHeaders()

'Response.CacheControl = "Private" 'Public

Response.AddHeader("Accept-Header", tamanoFichero.ToString())

Response.AddHeader("Content-Size", tamanoFichero.ToString())

Response.AddHeader("Content-Length", tamanoFichero.ToString())

Dim abrirEnAcrobatReader As Boolean = False

If abrirEnAcrobatReader Then

' Aparecería un cuadro de diálogo para Abrir o Guardar fichero

Response.AddHeader("Content-Disposition", "attachment; filename=" +
Path.GetFileName(nombreFichero))

Else

Response.AddHeader("Content-Disposition", "inline;filename=" + nombreFichero)

End If

'Response.AddHeader("Content-Disposition", "attachment; filename=" & fn)

'Response.AddHeader("Content-Disposition", "attachment; filename=" & fn& ";")

'Response.AddHeader("Content-Disposition", "inline; filename=" & fn)

'Response.AddHeader("Content-Disposition", "inline; filename=" & fn & ";")

'Response.AddHeader("Content-Disposition", "filename=" & fn)

'Response.AddHeader("Content-Disposition", "filename=" & fn & ";")

Response.AddHeader("Expires", "0")

Response.AddHeader("Pragma", "cache")

Response.AddHeader("Cache-Control", "private")

'//Set the output stream to the correct content type (PDF).

Response.ContentType = sMimeType

'Response.AddHeader("Content-Type", sMimeType)

Response.AddHeader("Accept-Ranges", "bytes")

Response.Charset = ""

Maybe this code below is a problem? What has
infoFichero.ContenidoFichero exactly, did you check it?
Response.BinaryWrite(infoFichero.ContenidoFichero)
Jul 10 '08 #2
Thanks, mister.

ContenidoFichero is Byte(), array of bytes of the file.

I'm sure, that I get all bytes right.

Greetings.
Maybe this code below is a problem? What has
infoFichero.ContenidoFichero exactly, did you check it?
Response.BinaryWrite(infoFichero.ContenidoFichero)
Jul 11 '08 #3
On Jul 11, 9:31*am, Alhambra Eidos Kiquenet
<AlhambraEidosKique...@discussions.microsoft.comwr ote:
Thanks, mister.

ContenidoFichero is Byte(), array of bytes of the file.

I'm sure, that I get all bytes right.

Greetings.
Maybe this code below is a problem? What has
infoFichero.ContenidoFichero exactly, did you check it?
Response.BinaryWrite(infoFichero.ContenidoFichero)- Hide quoted text -

- Show quoted text -
Oh, sorry, now I see what the question is. You added the file name for
the download stream at the following line

Response.AddHeader("Content-Disposition", "attachment; filename=" +
Path.GetFileName(nombreFichero))

The Filename parameter is used to suggest a file name in the download
dialog. I think you would need to change it

Response.AddHeader("Content-Disposition", "attachment; filename=" +
Request.QueryString("NAME"))
Jul 11 '08 #4

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

Similar topics

7
by: Markus Ernst | last post by:
Hi I know this question is rather HTTP related than PHP, but I did not find an HTTP group on my news server. I deliver some files with the following PHP syntax: header('Content-Description:...
22
by: googlegroups | last post by:
I am playing with the XMLHTTPRequest method to perform client/server transactions. I have it set up right now so that when readyState is 4, it takes the XML and processes it. This works great until...
3
by: Rob | last post by:
I have an ASP.Net web app that generates a Crystal Report in PDF format. Since there is sensitive data within the reports, the pdfs need to be streamed to the browser then deleted immediately. The...
5
by: John | last post by:
Hi all, I have an (well, what I think to be, at least) interesting question: Is it possible to stream data down to the client and, after a certain amount of data has been streamed, allow the...
3
by: A.M-SG | last post by:
Hi, I have a ASP.NET aspx file that needs to pass large images from a network storage to client browser. The requirement is that users cannot have access to the network share. The aspx file...
6
by: | last post by:
Hi all, is there a better way to stream binary data stored in a table in sql 2005 to a browser in .net 2.0? Or is the code same as in .net 1.1? We noticed that in certain heavy load scenarios,...
1
by: DB | last post by:
Hi All, I’m trying to stream a PDF with .NET 2.0 in a c# web app. However, it does not actually show the PDF (using adobe acrobat). The Situation: Click on a Button, Opens a new Window,...
2
by: SPG | last post by:
Hi, Two questions for you all.. Firstly, is there a way of streaming video using PHP? At the moment I just have a link to a video file and the whole thing downloads before playing which is a...
5
by: Jim Bancroft | last post by:
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...
3
by: Brad | last post by:
I have an aspx page that is sending pdf files to client browsers: it uses a filestream to read the pdf file and response.binarywrite to send content to the browser. This has worked great for years...
1
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.