Streaming PDF to IE 6.0 browser

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?=

    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?I DFILE=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.Buffe rOutput = True

    Response.Clear( )

    Response.ClearC ontent()

    Response.ClearH eaders()

    'Response.Cache Control = "Private" 'Public



    Response.AddHea der("Accept-Header", tamanoFichero.T oString())

    Response.AddHea der("Content-Size", tamanoFichero.T oString())

    Response.AddHea der("Content-Length", tamanoFichero.T oString())

    Dim abrirEnAcrobatR eader As Boolean = False

    If abrirEnAcrobatR eader Then

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

    Response.AddHea der("Content-Disposition", "attachment ; filename=" +
    Path.GetFileNam e(nombreFichero ))

    Else

    Response.AddHea der("Content-Disposition", "inline;filenam e=" + nombreFichero)

    End If

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

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

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

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

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

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

    Response.AddHea der("Expires", "0")

    Response.AddHea der("Pragma", "cache")

    Response.AddHea der("Cache-Control", "private")





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

    Response.Conten tType = sMimeType

    'Response.AddHe ader("Content-Type", sMimeType)

    Response.AddHea der("Accept-Ranges", "bytes")

    Response.Charse t = ""

    Response.Binary Write(infoFiche ro.ContenidoFic hero)

    Response.Flush( )

    'Response.Write File(fichero)

    'Response.Close ()

    Response.End()

    --





  • Alexey Smirnov

    #2
    Re: Streaming PDF to IE 6.0 browser

    On Jul 8, 3:03 pm, Alhambra Eidos Kiquenet
    <AlhambraEidosK ique...@discuss ions.microsoft. comwrote:
    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?I DFILE=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.Buffe rOutput = True
    >
    Response.Clear( )
    >
    Response.ClearC ontent()
    >
    Response.ClearH eaders()
    >
    'Response.Cache Control = "Private" 'Public
    >
    Response.AddHea der("Accept-Header", tamanoFichero.T oString())
    >
    Response.AddHea der("Content-Size", tamanoFichero.T oString())
    >
    Response.AddHea der("Content-Length", tamanoFichero.T oString())
    >
    Dim abrirEnAcrobatR eader As Boolean = False
    >
    If abrirEnAcrobatR eader Then
    >
    ' Aparecería un cuadro de diálogo para Abrir o Guardar fichero
    >
    Response.AddHea der("Content-Disposition", "attachment ; filename=" +
    Path.GetFileNam e(nombreFichero ))
    >
    Else
    >
    Response.AddHea der("Content-Disposition", "inline;filenam e=" + nombreFichero)
    >
    End If
    >
    'Response.AddHe ader("Content-Disposition", "attachment ; filename=" & fn)
    >
    'Response.AddHe ader("Content-Disposition", "attachment ; filename=" & fn& ";")
    >
    'Response.AddHe ader("Content-Disposition", "inline; filename=" & fn)
    >
    'Response.AddHe ader("Content-Disposition", "inline; filename=" & fn & ";")
    >
    'Response.AddHe ader("Content-Disposition", "filename=" & fn)
    >
    'Response.AddHe ader("Content-Disposition", "filename=" & fn & ";")
    >
    Response.AddHea der("Expires", "0")
    >
    Response.AddHea der("Pragma", "cache")
    >
    Response.AddHea der("Cache-Control", "private")
    >
    '//Set the output stream to the correct content type (PDF).
    >
    Response.Conten tType = sMimeType
    >
    'Response.AddHe ader("Content-Type", sMimeType)
    >
    Response.AddHea der("Accept-Ranges", "bytes")
    >
    Response.Charse t = ""

    Maybe this code below is a problem? What has
    infoFichero.Con tenidoFichero exactly, did you check it?
    Response.Binary Write(infoFiche ro.ContenidoFic hero)

    Comment

    • =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?=

      #3
      Re: Streaming PDF to IE 6.0 browser

      Thanks, mister.

      ContenidoFicher o 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.Con tenidoFichero exactly, did you check it?
      >
      Response.Binary Write(infoFiche ro.ContenidoFic hero)
      >

      Comment

      • Alexey Smirnov

        #4
        Re: Streaming PDF to IE 6.0 browser

        On Jul 11, 9:31 am, Alhambra Eidos Kiquenet
        <AlhambraEidosK ique...@discuss ions.microsoft. comwrote:
        Thanks, mister.
        >
        ContenidoFicher o 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.Con tenidoFichero exactly, did you check it?
        >
        Response.Binary Write(infoFiche ro.ContenidoFic hero)- 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.AddHea der("Content-Disposition", "attachment ; filename=" +
        Path.GetFileNam e(nombreFichero ))

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

        Response.AddHea der("Content-Disposition", "attachment ; filename=" +
        Request.QuerySt ring("NAME"))

        Comment

        Working...