Aspose Failure to convert Gif to Pdf using Memorystreams

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

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.ଛ.ஒ(Image ֣, Object க, Boolean ஖)

at Aspose.Pdf.Figure.፟.፠(֟ ኯ, Int32 ൜, String ֥, Boolean ኴ, Stream ֭)

at Aspose.Pdf.Figure.኱.ኲ(֟ ኯ, Int32 ኳ, ImageFileType ֤, String ֥, String ֦, String ֧, Int32 ֨, Int32 ֩, Boolean ֪, Boolean ֫, Boolean ኴ, Byte[] ֬, Stream ֭)

at Aspose.Pdf.Figure.֟.֢(Image ֣, ImageFileType ֤, String ֥, String ֦, String ֧, Int32 ֨, Int32 ֩, Boolean ֪, Boolean ֫, Byte[] ֬, Stream ֭)

at Aspose.Pdf.Xml.ከ.ክ(Pdf ӟ, Image ֣)

at Aspose.Pdf.Xml.ᗣ.፻(Pdf ӟ, Section ፼, Table ࡾ, Row ሾ, Cell Փ, Image ֣, ӫ ӿ, ᎎ ፸, Boolean ᎀ)

at Aspose.Pdf.Xml.ᖪ.ᖭ(Pdf ӟ, Section ᇐ, ӫ ӿ)

at Aspose.Pdf.Xml.٫.ኇ(Pdf ӟ)

at Aspose.Pdf.Xml.ᝇ.ᝌ(Ӭ ᄋ, Pdf ӟ)

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.