Re: Open new window and display PDF document...

Discussion in 'ASP .Net' started by Moe Sisko, Jun 4, 2008.

  1. Moe Sisko

    Moe Sisko Guest

    You're on the right track, but you'll also need to use
    Page.ClientScript.RegisterStartupScript.

    e.g. user clicks a "show document" button.
    On server side, use ClientScript.RegisterStartupScript to register the
    javascript which you want to automatically run on the client.
    Write the javascript so that it opens a new brower window (using window.open
    etc) at the new page which you will use to display the PDF.

    On the new PDF page, do something like this to display the PDF in the
    Page_Load event :

    byte[] data = ... fill with PDF data
    Response.Clear();
    Response.ContentType = "application/pdf";
    Response.BinaryWrite(data);
    Response.End();



    "H. Rodriguez" <> wrote in message
    news:...
    > Hello,
    >
    > I would like to be able to open a new IE window on the client side and
    > display a PDF document in the new window. Many tutorial sites that I have
    > checked suggest opening a new IE window using client-side JavaScript and
    > the window.open() function. I suspect this is not the desired way as I
    > would like to output a PDF report from a byte array to the HTTP output
    > stream to this new window.
     
    Moe Sisko, Jun 4, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Norman Yuan
    Replies:
    0
    Views:
    589
    Norman Yuan
    Jun 3, 2008
  2. PC HUA
    Replies:
    2
    Views:
    471
    PC HUA
    May 19, 2004
  3. Replies:
    0
    Views:
    140
  4. mistral
    Replies:
    6
    Views:
    303
    Thomas 'PointedEars' Lahn
    Jul 13, 2008
  5. mistral
    Replies:
    1
    Views:
    320
    Erwin Moller
    Jul 9, 2008
Loading...

Share This Page