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();
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().
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.