ReportViewer to PDF inside div/image/object

前提是你 提交于 2019-12-02 11:56:23
mason

First, create a Generic Handler called GeneratePDF.ashx. Note I didn't write the below code and I'm not a VB.NET programmer, so I can't guarantee it'll work.

'generate bytes, perhaps based on Request.QueryString parameters
`write bytes to output
Response.Buffer = True
Response.Clear()
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "inline; filename=" & filename & "." & extension)
Response.BinaryWrite(bytes)
Response.Flush()

Then on our page, we use one of the techiques from the below link to embed the PDF, making sure to give the URL that points to our generic handler, and passing any parameters needed to generate the PDF via query string.

<embed src="GeneratePDF.ashx?parameter1=asdf&parameter2=qwer" width="500" height="375" type="application/pdf" />

Above code adapted from Recommended way to embed PDF in HTML?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!