Display dynamically created pdf embedded in browser (IE9)
I am trying to display a dynamically created PDF (Byte()) loading the default viewer int he client browser. The following code works with all browsers except the microsoft ones consistently. IE9 Wants to run MSXML 3.0 SP11 in response to the page. Here is the code generating the page:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim pdfData() As Byte
'load PDF Data
If pdfData.Length < 1 Then
Response.Write("ERROR - No data")
Response.End()
Return
End If
Re开发者_Go百科sponse.Clear()
Response.AddHeader("Content-Disposition", "inline;filename=newcomp.PDF")
Response.AddHeader("Content-Length", pdfData.Length.ToString())
Response.AddHeader("Pragma", "no-cache")
Response.ContentType ="application/pdf"
Response.BinaryWrite(pdfData)
Response.Flush()
HttpContext.Current.ApplicationInstance.CompleteRequest()
End Sub
I call the page like this: http://localhost/DisplayPdf.aspx?newcomp.pdf
You can try it yourself with this link: http://www.netvaluecentral.com/DisplayPdf.aspx?newcomp.pdf
Any ideas?
精彩评论