Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 04, 2012 01:00 PM by jozolo
Jan 03, 2011 09:26 PM|LINK
Its not a code problem. Use Foxit Reader and it will open it. pdf's created in a much older version of Adobe's creator software cannot be opened by 9.x and version 10 in some scenarios. This problem occurs on Windows 7 Pro and Windows XP SP 3.
Mar 09, 2011 06:42 PM|LINK
I don't think the error is in your code for downloading the document. I believe the error is happening because of how the document is originally stored in the database. Make sure you aren't using the GetBuffer() method when writing the file to the database.
Try using ToArray() instead and it will not append extra characters to the end of your file stream. Here's a link to give you some more details:
The extra characters after the %%EOF tag at the end of your PDF document are most likely what is causing the message:
Try opening your document in VIM/SlickEdit, etc (something that shows hidden characters) to verify that extra data is getting tacked onto the end of the file (it will just look like a bunch of spaces in notepad). You can also confirm this by checking the
size of the document vs. the size of the data stored in your database field.
I hope this helps.
May 04, 2012 01:00 PM|LINK
This is an old post, but it helped me solve my similar problem, so I'm adding my findings to this post in the hopes that it helps someone else.
I encountered this problem as well. Jason's tip to open the document in a text editor helped me get to the bottom of my problem, along with Glade's mentioning of extra characters after the %%EOF. The problem was extra characters after the EOF that were
getting added after my document was being displayed.
Looking at maniac's code, I see the same issue in his code that was causing the problem in my code. There was a Response.End() that both maniac and I had commented out because it was giving a Threading.ThreadAbortException. That Response.End() is required,
or else extra content will be appended to the bottom of the PDF file, causing it to be corrupted on retrieval from the database.
As a side-note, I had tried replacing my Response.End() with a HttpContext.Current.ApplicationInstance.CompleteRequest(), but that was not sufficient to avoid appending the extra content to the PDF.