I have a Crystal Report that I'm trying to export as a stream as a PDF. I'm able to view it in the Crystal Report Viewer in the browser, but when I open the PDF in a new tab in Chrome, I get an error stating it failed to load the PDF. Whenever I run it on my server, I get the error, but I do not get the error running locally. Do you know what could cause this?
Dim expStream As Stream = CurReport.ExportToStream(expFormatType)
expStream.Seek(0, SeekOrigin.Begin)
Dim abyBuffer As Byte() = New Byte(expStream.Length - 1) {}
expStream.Read(abyBuffer, 0, expStream.Length)
expStream.Dispose()
expStream = Nothing
Response.Buffer = True
Response.Clear()
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "inline; filename=" & rptFile)
Response.AddHeader("content-length", abyBuffer.Length.ToString())
Response.OutputStream.Write(abyBuffer, 0, abyBuffer.Length) ' Send to client
Response.Flush() ' Finalize
HttpContext.Current.ApplicationInstance.CompleteRequest()