Aspose Failure to convert Gif to Pdf using Memorystreams

When using MemoryStream for input and output sources, an exception is thrown by Aspose. I do not get this exception if using filename paths.

Using Aspose.Pdf 3.3.2.0

InnerException Type: System.IndexOutOfRangeException
InnerException Message: Index was outside the bounds of the array.
InnerException StackTrace:

* at Aspose.Pdf.Figure...
* at Aspose.Pdf.Figure...
* at Aspose.Pdf.Figure...
* at Aspose.Pdf.Figure...
* at Aspose.Pdf.xml....
* at Aspose.Pdf.xml....
* at Aspose.Pdf.xml....
* at Aspose.Pdf.Pdf.Save(Stream stream)
* at WS.AsposePDFManager.ConvertFileToPDF(String sourceFile, String targetFile) in D:\Documents and Settings\smi\MyDocuments\PDFManager\AsposePDFManager.cs:line 1184

Within ConvertFileToPDF() I create MemoryStreams:

MemoryStream inputFile = new MemoryStream(File.ReadAllBytes(sourceFile));
MemoryStream destinationFile = new MemoryStream();

Line 1184 is:

pdfFile.Save(destinationFile);

I can not reproduce the same error as you metioned above.

Please provide the source File in attachment for us further testing.

I have attached a similar Gif (Gif I tested with is proprietary and I cannot post) that also resulted in similar exception when using MemoryStreams as input and output.

I have since found an intermediate solution that works without exception thrown. I no longer use stream for input. I use the filenamepath for input imageInfo.File attribute (not using imageInfo.ImageStream) and I use MemoryStream for destination in PdfFile.Save().

Thanks for reporting this mistake that has been reproduced on testbed.

I will investigate with developers and try to fix it soon.

After inverstigation we found this bug can’t be fixed in short time. We might need weeks to fix it. As a workaround please use file instead of stream.