How to Open report exported file in another window

Discussion in 'ASP .Net' started by Guest, May 5, 2004.

  1. Guest

    Guest Guest

    I'm using this code to export the crystal report file into pdf format and
    stream the file to the browser:

    ReportDocument oRpt = new ReportDocument();
    oRpt.Load(MapPath("MyReport.rpt"));
    oRpt.SetDataSource(ds.Tables[0]);
    Stream St = oRpt.ExportToStream(ExportFormatType.PortableDocFormat);

    Response.ClearHeaders();
    Response.ClearContent();
    Response.ContentType = "Application/PDF";

    Byte[] buffer = new Byte[St.Length];
    St.Read(buffer, 0, (int) St.Length);
    Response.BinaryWrite(buffer);
    Response.End();

    Everything works fine, but the pdf file is opened in the same browser
    window.


    Is it possible to open the pdf file in another window, without exporting the
    file to disk first ?

    // Ex: This also works (the pdf file is opened in another browser window),
    but the file is exported to disk first.
    oRpt.ExportToDisk(ExportFormatType.PortableDocFormat, LongFileName);
    Response.Write("<script>window.open('"+Request.ApplicationPath+"/Files/"+Fil
    eName+"');</script>");


    Thanks
     
    Guest, May 5, 2004
    #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. =?Utf-8?B?endlbmc=?=

    filename in exported excel file

    =?Utf-8?B?endlbmc=?=, Apr 9, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    610
    Scott
    Apr 9, 2004
  2. Zodiac

    Cannot read exported XML File

    Zodiac, May 10, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    2,571
    Ken Cox [Microsoft MVP]
    May 10, 2005
  3. Replies:
    1
    Views:
    1,175
    Oliver Wong
    Dec 15, 2006
  4. gaurav kashyap
    Replies:
    3
    Views:
    6,655
    Paul Boddie
    Oct 31, 2008
  5. PC HUA
    Replies:
    2
    Views:
    423
    PC HUA
    May 19, 2004
Loading...

Share This Page