2
语言:ASP.NET/VB.NETpdf文件未显示在Internet Explorer中
我正在使用itextsharp库创建pdf文件。在我的开发机器生成的文件打开没有任何问题。但是,当我在生产服务器上传编译的程序时,Internet Explorer只是打开并关闭窗口,但不显示PDF文件。其他浏览器正在显示PDF文件。
这里是我使用
Dim LABNO As Integer = Request.QueryString("LABNO")
Dim vDoc As New iTextSharp.text.Document(PageSize.A4, 20, 20, 50, 50)
Dim vOutPut As New IO.MemoryStream
Dim vWriter = pdf.PdfWriter.GetInstance(vDoc, vOutPut)
Dim cb As New PdfContentByte(vWriter)
MakeReceipt(LABNO, vDoc, cb)
vDoc.NewPage()
MakeReceipt(LABNO, vDoc, cb)
'MakeSheet(LABNO)
vDoc.Close()
Dim rnd As New Random
Response.Clear()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "Application/pdf"
Response.AddHeader("Content-Disposition", String.Format("attachment;filename=Rct-{0}.pdf", rnd.Next.ToString()))
Response.BinaryWrite(vOutPut.ToArray())
Response.Flush()
感谢布鲁诺的快速响应,我正在应用这些更改并检查开发服务器。 – raj
我正在检查此项,并在测试后恢复。 – raj
它对我不起作用:( – raj