Last post Mar 07, 2018 08:36 AM by Eric Du
Mar 06, 2018 06:39 AM|shsu|LINK
There is a pdf attachment in the gridview.I can open all other attachment except one(5).Each atachment is in each row of gridview.5th one, when i open below error message is coming
There was an error opening this document.The file is damaged and could not be repaired. How to solve this issue.
(When I open that PDF from its path(c:..)it is opening.)
Code as below:
'set the http content type to "application/pdf"
HttpContext.Current.Response.ContentType = "application/pdf"
'set the http content type to
HttpContext.Current.Response.ContentType = "APPLICATION/OCTET-STREAM"
End If '
'initialize the http content-disposition header to
' indicate a file attachment with the filename
Dim disHeader As String = "Attachment;
Filename=" & sFileName
' transfer the file byte-by-byte to the response object
Catch ex As Exception
Mar 07, 2018 08:36 AM|Eric Du|LINK
According to your description, i think this is because something wrong in the PDF file, here are someone who meet the similar issue as you, please check:
PDF rendering issues on IE 11:
ASP.Net PDF document in Database error: There was an error opening this document. The file is damaged and could not be repaired: