G
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
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