Display PDF in Web Application

前端 未结 5 730
轮回少年
轮回少年 2021-01-03 01:46

I have googled this, searched this, looked through SO and other sites (I\'ve been trying to read on this issue for hours now), but I still can\'t seem to find a satisfactory

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-03 02:29

    This is how I do to open a PDF document in the browser from an ASP.NET (aspx) page. In the page OnLoad:

            this.Response.Clear();
            this.Response.Buffer = true;
            this.Response.ContentType = "application/pdf";
            this.Response.AddHeader("content-length", pdfReportStream.Length.ToString());
            this.Response.BinaryWrite(pdfReportStream.ToByteArray());
    
            this.Response.End();
    

提交回复
热议问题