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

Free Support Forum - aspose.com

PDF save/validate method generating EndOfStreamException

I am currently evaluating the .net PDF ( V8.0.0) component with a view to using it for server-side conversions of PDF to HTML. I have also been looking into the Word component which is working really well. However, the PDF save ( or validate ) method always throws this errors (many times):

A first chance exception of type 'System.IO.EndOfStreamException' occurred in mscorlib.dll

at System.IO.BinaryReader.ReadByte() at System.IO.BinaryReader.ReadByte()

Test code:

var pdfLicense = new Aspose.Pdf.License();
pdfLicense.SetLicense("Aspose.Pdf.lic");

Document doc = new Aspose.Pdf.Document(@"c:\tmp\pdfconvert\test.pdf");
doc.Save(@"c:\tmp\pdfconvert\done\mypdf.html", SaveFormat.Html);

For a large pdf this is thrown many times and obviously slows down the conversion process. I have tried with all of the versions supplied but get the same error.

The only PDF that does not generate the errors is a blank pdf document created from within Aspose.PDF itself E.g:

var doc1 = new Aspose.pdf.Document();
doc1.Save(@"c:\tmp\convertTest\saved.pdf");var doc1 = new Aspose.pdf.Document();
doc1.Save(@"c:\tmp\convertTest\saved.pdf");

I am sure I am missing something really obvious so I would appreciate any pointers.

Thanks.

Nige.

I have attached the simplest of PDF file which still generates the endOfStreamException.

I would be grateful for any assistance from support as my company needs to make a decision on which conversion tool to use within the next few days.

Many thanks.

Nigel.

Hi Nige,


Thanks for your interest in our products and sorry for the delayed response.

I have tested the scenario where I have tried converting the PDF file which you have shared into HTML format using Aspose.Pdf for .NET 8.0.0 in Visual Studio 2010 application running over Windows 7 (X64) and I am unable to notice any issue. For your convenience, I have also attached the resultant HTML which is generated over my end (please change file extension from .TXT to .HTML as file upload module does not allow HTML upload).

[C#]

Document doc = new
Aspose.Pdf.Document(@“c:\pdftest\test.pdf”);<o:p></o:p>

doc.Save(@“c:\pdftest\mypdf.html”,
Aspose.Pdf.SaveFormat.Html);



Can you please share some further details regarding your working environment
  • Operating System version
  • Visual Studio version
  • .NET framework version etc.

Hi Nayyerv,

Thanks for the response.

I have just realised that these are just first chance exceptions within Aspose code and that I had break on CLR exception set in the debugger.

Everything now seems to work fine and my company should be confirming an order shortly.

Regards.

Nigel.