We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PDF EOF error (html appended at the end of the pdf)

I'm using the following code in asp.net button click event:

string fileLocation = System.Configuration.ConfigurationSettings.AppSettings["DocumentPath"] + "\\" + doc.FileName;

string outputFileName = "mytest.pdf";


Response.AddHeader("content-disposition", "attachment; filename=" + outputFileName);

FileStream documentInstream = new FileStream(fileLocation, FileMode.Open, FileAccess.Read);

Stream[] allFileStreams = new Stream[1];

allFileStreams[0] = documentInstream;

PdfFileEditor pdfEditor = new PdfFileEditor();

pdfEditor.Concatenate(allFileStreams, Response.OutputStream);

The problem is that the resultant PDF file has the webpage's HTML in it after the EOF marker. This is causing problems when viewing the document in adobe 7 or lower.

This is an urgent problem for us. Please let me know if there is any way to make sure that the html is not appended at the end? (I'm using the latest dlls)

Hello Mike,

Can you please share the source PDF documents causing issues and the complete code, so that we can test the scenario at our end. We apologize for your inconvenience.

I am attaching the aspx code + input and output file.

Notice how the output file has increase in size and added on all of the html from the webpage after the EOF marker in the pdf source.

Has anyone confirmed the problem with the attachments from last Thursday?

Hello Mike,

Sorry for replying you late. We are looking into this matter and will get back to you ASAP. We apologize for the delay and inconvenience.

Hi Mike,

Please add the following line of code at the end of the snippet and it’ll be working fine:


If you still find the same issue or have any further questions, please do let us know.

That worked for me. Thanks.