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

Free Support Forum - aspose.com

Exception with message " Unable to read beyond the end of the stream. "

Conversion of word files to PDF failed with Aspose.word (ver.9.0.0). Following are 3 null reference exceptions and code snippet. Can you please provide fix asap?
Code:
        public static void ConvertWordToPdf(string sourceFilePath, string destinationFilePath)
    {                     
        Aspose.Words.Document doc = new Aspose.Words.Document(sourceFilePath);
                                doc.Save(destinationFilePath,Aspose.Words.SaveFormat.Pdf);           
        
    }</span></pre>exception:</pre><pre style="font-size: 17px; text-align: left; background-color: rgb(240, 240, 240); word-wrap: break-word; white-space: pre-wrap; "><br></pre><pre style="font-size: 17px; text-align: left; background-color: rgb(240, 240, 240); word-wrap: break-word; white-space: pre-wrap; "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">Timestamp: 1/20/2012 4:33:45 AM</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">Message: HandlingInstanceID: 049fff2e-882c-4cb9-b9d7-e02b6d393794</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><Exception></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><Description>An exception of type 'System.IO.EndOfStreamException' occurred and was caught.</Description></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><DateTime>2012-01-19 23:33:45Z</DateTime></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><ExceptionType>System.IO.EndOfStreamException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><Message>Unable to read beyond the end of the stream.</Message></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><Source>mscorlib in file: C:\WINDOWS\TEMP\IntraLinks\34074409-26c8-4416-9c8e-f09cc0fa2af9.xls</Source></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><HelpLink /></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><Property name="Data">System.Collections.ListDictionaryInternal</Property></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><Property name="TargetSite">Void EndOfFile()</Property></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><StackTrace> at System.IO.__Error.EndOfFile()</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">at System.IO.BinaryReader.FillBuffer(Int32 numBytes)</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">at System.IO.BinaryReader.ReadUInt16()</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">at x4974cb5652d7d108.xd686a7cfdb7bddb2..ctor(BinaryReader reader)</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">at x4974cb5652d7d108.xd8c3135513b9115b.x2f7b1d8f41a4e758()</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">at x4974cb5652d7d108.xd8c3135513b9115b.x5d95f5f98c940295(Stream xcf18e5243f8d5fd3)</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">at Aspose.Cells.Workbook.Open(Stream stream, FileFormatType type)</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">at Aspose.Cells.Workbook.Open(String fileName)</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">at Intralinks.Common.Utilities.AsposeConverter.ConvertXlsToPdf(String sourceFilePath, String destinationFilePath) in c:\ilbuilds\pdfconv\build_trunk\CommonUtilities\AsposeConverter.cs:line 71</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">at Intralinks.Common.Utilities.CommonUtilities.ConvertOfficeDocsToPDF(String sourceFile, String destinationFolder, Boolean useOriginalFileName) in c:\ilbuilds\pdfconv\build_trunk\CommonUtilities\CommonUtilities.cs:line 1385</StackTrace></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><additionalInfo></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><info name="MachineName" value="WDPDPF01" /></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><info name="TimeStamp" value="1/20/2012 4:33:45 AM" /></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><info name="FullName" value="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" /></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><info name="AppDomainName" value="ILPDFConversionService.exe" /></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><info name="ThreadIdentity" value="" /></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><info name="WindowsIdentity" value="NT AUTHORITY\SYSTEM" /></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "></additionalInfo></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "></Exception></span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">Category: Logging Exception</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">Priority: 1</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">EventId: 100</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">Severity: Error</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">Title:Enterprise Library Exception Handling</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">Machine: WDPDPF01</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">Application Domain: ILPDFConversionService.exe</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">Process Id: 4820</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">Process Name: C:\PDFConvService\WOODDALE.pdfconv\instance2\Release\ILPDFConversionService.exe</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">Win32 Thread Id: 2732</span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">Thread Name: </span><br style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 12px; text-align: -webkit-auto; white-space: normal; background-color: rgb(255, 255, 255); ">Extended Properties: Product Version - 3.0.24944.0</span>

Hi there,


Thanks for your inquiry.

Could you please attach your input document which reproduces the issue here? We will look into this further for you.

Thanks,