Z
Zoury
Hi folks ! :O)
I'm trying to show a PDF in ASP.NET but I can't get to work properly.
here's a portion of my code :
'**
Dim ms As MemoryStream =
DirectCast(m_report.FormatEngine.ExportToStream(reqContext), MemoryStream)
If (fileName Is Nothing) Then
' shows the PDF to the user
With Response
.ClearHeaders()
.ClearContent()
.ContentType = "application/pdf"
ms.WriteTo(.OutputStream)
.Flush()
End With
Else
' writes the PDF on the disk
Dim fs As New FileStream(fileName, FileMode.CreateNew)
ms.WriteTo(fs)
fs.Close()
End If
'**
If I write the MemoryStream to disk and open the file, it appears correctly.
If I write the MemoryStream into the Response.OutputStream object, i get a
the following message :
---------------------------
Acrobat Reader
---------------------------
The file is damaged and could not be repaired.
---------------------------
OK
---------------------------
I also tried to use Response.SuppressContent = True just in case other stuff
was written in the OutputStream but unfortunatly the only thing i got from
doing so was a blank page (and no alert anymore).
Any ideas of what's happening ?
Thanks a lot !
I'm trying to show a PDF in ASP.NET but I can't get to work properly.
here's a portion of my code :
'**
Dim ms As MemoryStream =
DirectCast(m_report.FormatEngine.ExportToStream(reqContext), MemoryStream)
If (fileName Is Nothing) Then
' shows the PDF to the user
With Response
.ClearHeaders()
.ClearContent()
.ContentType = "application/pdf"
ms.WriteTo(.OutputStream)
.Flush()
End With
Else
' writes the PDF on the disk
Dim fs As New FileStream(fileName, FileMode.CreateNew)
ms.WriteTo(fs)
fs.Close()
End If
'**
If I write the MemoryStream to disk and open the file, it appears correctly.
If I write the MemoryStream into the Response.OutputStream object, i get a
the following message :
---------------------------
Acrobat Reader
---------------------------
The file is damaged and could not be repaired.
---------------------------
OK
---------------------------
I also tried to use Response.SuppressContent = True just in case other stuff
was written in the OutputStream but unfortunatly the only thing i got from
doing so was a blank page (and no alert anymore).
Any ideas of what's happening ?
Thanks a lot !