Free Support Forum - aspose.com

Out of mem exception while converting CDR file to PDF using aspose imaging .net (ver 20.11) library

Hello,

I am trying to convert a CDR file to PDF using aspose imaging .net library(20.11). Getting out of memory exception while converting the file.

File link : https://drive.google.com/file/d/15cr3JJA1sO_pcb-IpHgvUymqpBe9JMAO/view?usp=sharing

Exception details:
Aspose.Imaging.CoreExceptions.ImageLoadException: Image loading failed. —> System.OutOfMemoryException: Exception of type ‘System.OutOfMemoryException’ was thrown.
at System.IO.MemoryStream.set_Capacity(Int32 value)
at System.IO.MemoryStream.EnsureCapacity(Int32 value)
at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at ?? .?? , Int32 , Boolean )
at ?? .?? , CdrObject , Int32[] )
at ?? .?? , CdrObjectContainer , Int32[] )
at ?? .?? , CdrObject , Int32[] )
at ?? .?? )
at ?? .()
at Aspose.Imaging.FileFormats.Cdr.CdrImage…ctor(Stream stream, LoadOptions loadOptions)
at .Load(StreamContainer , LoadOptions )
at Aspose.Imaging.Image.(StreamContainer , LoadOptions )
— End of inner exception stack trace —
at Aspose.Imaging.Image.(StreamContainer , LoadOptions )
using (var img = Aspose.Imaging.Image.Load(filePath + “.cdr”))
{
CdrRasterizationOptions rasterizationOptions = new CdrRasterizationOptions();
rasterizationOptions.PageWidth = img.Width;
rasterizationOptions.PageHeight = img.Height;
// Save image to Pdf
PdfOptions exportOptions = new PdfOptions();
exportOptions.VectorRasterizationOptions = rasterizationOptions;
img.Save(filePath + “.pdf”, exportOptions);
return filePath + “.pdf”;
}

Am using the following code to convert file:

@vvorld

A ticket with ID IMAGINGNET-4262 has been created in our issue tracking system to investigate and resolved the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.