Exception " Image export failed" while converting a DWG file into PDF using Aspose.CAD for .NET

Hello, we have an exception converting a DWG file to pdf.
The file is located on this [link]* for your tests.

*https://test.boolebox.com/app/index.html?obj=3300360030003500360031003200380037003700360033003300320035003700380032003300

the exception is:
Aspose.CAD.CadExceptions.ImageSaveException: Image export failed. —> System.NullReferenceException: Object reference not set to an instance of an object.
at .Export(Image , Stream , ImageOptionsBase , Rectangle )
at Aspose.CAD.Image.jd3e6ze6d4bq8slwvmklfafdjn7dzqla (Stream , ImageOptionsBase , Rectangle )
— End of inner exception stack trace —
at Aspose.CAD.Image.jd3e6ze6d4bq8slwvmklfafdjn7dzqla (Stream , ImageOptionsBase , Rectangle )
at Aspose.CAD.FileFormats.Cad.CadImage.jd3e6ze6d4bq8slwvmklfafdjn7dzqla (Stream , ImageOptionsBase , Rectangle )
at Aspose.CAD.Image.Save(Stream stream, ImageOptionsBase optionsBase, Rectangle boundsRectangle)
at Aspose.CAD.Image.Save(Stream stream, ImageOptionsBase optionsBase)

@BooleServer,

I have worked with file shared by you using Aspose.Cad for .NET 17.09 and have been able to observe the issue. A ticket with ID CADNET-465 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with issue so that you may be automatically notified once issue will be fixed.

Please share us some news about CADNET-465
We didn’t receive any notice from November 2017!

@BooleServer,

I have observed your comments. I like to share that this issue is going to be resolved tentatively in Aspose.CAD 18.1. We will share good news with you soon.

The issues you have found earlier (filed as CADNET-465) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by mudassir.fayyaz

tried with aspose.cad 18.3 and the problemi is still here, although it is different!
please try it

Aspose.CAD.CadExceptions.ImageSaveException: Image export failed. —> System.IO.FileLoadException: Could not load file or assembly ‘Aspose.Pdf, Version=18.1.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at .Export(Image , Stream , ImageOptionsBase , Rectangle )
at Aspose.CAD.Image.jd3e6ze6d4bq8slwvmklfafdjn7dzqla (Stream , ImageOptionsBase , Rectangle )

@BooleServer,

I have observed the issue shared by you and request you to please share a working sample project reproducing the issue on your end. We will use that to investigate the issue further on our end.

IT goes on exeption System.outofmemory: maybe is too mutch for our machine?

@BooleServer,

It may be some local issue on your end. If you still find an issue then please share a working sample project reproducing the issue so that we may verify the same on our end.

We tried in debug and on server but we thrown the outofmemory exeption with file: https://test.boolebox.com/app/index.html?obj=3700390039003600300032003100340032003000300037003800360037003800310030003800
This is our code, the error is only when it comes on last row with Save method:

        m_oDocument = Aspose.CAD.Image.Load(_oInputStream);
        Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
        rasterizationOptions.PageWidth = ((Aspose.CAD.Image)m_oDocument).Width;
        rasterizationOptions.PageHeight = ((Aspose.CAD.Image)m_oDocument).Height;
        //resize 
        if (((Aspose.CAD.FileFormats.Cad.CadImage)m_oDocument).Width > ((Aspose.CAD.FileFormats.Cad.CadImage)m_oDocument).Height)
        {
            if (((Aspose.CAD.FileFormats.Cad.CadImage)m_oDocument).Width > 1024)
            {
                int iWidth = 1024;
                int iHeight = (int)((1024.0f / (float)((Aspose.CAD.FileFormats.Cad.CadImage)m_oDocument).Width) * (float)((Aspose.CAD.FileFormats.Cad.CadImage)m_oDocument).Height);
                rasterizationOptions.PageWidth = iWidth;
                rasterizationOptions.PageHeight = iHeight;
            }
        }
        else
        {
            if (((Aspose.CAD.Image)m_oDocument).Height > 1024)
            {
                int iHeight = 1024;
                int iWidth = (int)((1024.0f / (float)((Aspose.CAD.FileFormats.Cad.CadImage)m_oDocument).Height) * (float)((Aspose.CAD.FileFormats.Cad.CadImage)m_oDocument).Width);
                rasterizationOptions.PageWidth = iWidth;
                rasterizationOptions.PageHeight = iHeight;
            }
        }

        //imposto i colori per evitare di usare quelli originali (potrei avere linee uguali allo sfondo)
        rasterizationOptions.BackgroundColor = Aspose.CAD.Color.White;
        rasterizationOptions.DrawColor = Aspose.CAD.Color.Black;
        rasterizationOptions.DrawType = Aspose.CAD.FileFormats.Cad.CadDrawTypeMode.UseDrawColor;
        rasterizationOptions.CenterDrawing = true;
        //layout impostato = al numero di pagina (un immagine per ogni layout)    
        // se non ci sono layout stampa tutti i livelli (una pagina)
        if (((Aspose.CAD.FileFormats.Cad.CadImage)m_oDocument).Layouts.Count > 0)
        {
            Aspose.CAD.FileFormats.Cad.CadLayoutDictionary layouts = ((Aspose.CAD.FileFormats.Cad.CadImage)m_oDocument).Layouts;
            string[] layoutNames = new string[1];
            int l = 0;
            foreach (Aspose.CAD.FileFormats.Cad.CadObjects.CadLayout layout in layouts.Values)
            {
                if (l == _iPageIndex)
                {
                    layoutNames[0] = layout.LayoutName;
                }
                l++;
            }
            rasterizationOptions.Layouts = layoutNames;
        }
        if (m_eImgFormat == eImageConversion.Jpeg)
        {
            Aspose.CAD.ImageOptions.JpegOptions OptionsI = new Aspose.CAD.ImageOptions.JpegOptions();
            Aspose.CAD.ResolutionSetting oResI = new Aspose.CAD.ResolutionSetting(Convert.ToDouble(m_iResolution), Convert.ToDouble(m_iResolution));
            OptionsI.ResolutionSettings = oResI;
            OptionsI.VectorRasterizationOptions = rasterizationOptions;
            ((Aspose.CAD.Image)m_oDocument).Save(_oOutputStream, OptionsI);
        }
        else
        {
            Aspose.CAD.ImageOptions.PngOptions OptionsI = new Aspose.CAD.ImageOptions.PngOptions();
            OptionsI.ColorType = Aspose.CAD.FileFormats.Png.PngColorType.TruecolorWithAlpha;
            //OptionsI.TransparentColor = new Aspose.Imaging.TransparentColorSetting(Aspose.Imaging.Color.Transparent);
            Aspose.CAD.ResolutionSetting oResI = new Aspose.CAD.ResolutionSetting(Convert.ToDouble(m_iResolution), Convert.ToDouble(m_iResolution));
            OptionsI.ResolutionSettings = oResI;
            OptionsI.VectorRasterizationOptions = rasterizationOptions;
            ((Aspose.CAD.Image)m_oDocument).Save(_oOutputStream, OptionsI);
        }

@BooleServer,

I have observed your comments. Can you please share complete working sample project as we have requested you earlier so that we may reproduce issue on our end.

Sorry i can’t obviously, but the code i have submitted is the complete core reguarding that cad file: i can save it in a cs file but you can do the same for yourself and pass to the cs the stream of the file…

@BooleServer,

I have worked with file shared by you using Aspose.Cad for .NET 18.3 and have been able to observe the issue. A ticket with ID CADNET-617 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with issue so that you may be automatically notified once issue will be fixed.

hello, any news?

@BooleServer,

I have observed your comments and regret to inform that issue is still under investigation and we will share good news with you soon. I request for your patience.

I like to inform that we have investigated issue in details and for further investigation can you please share Stack trace of the issue and also please shorten the example code and declare all variables with settings (_iPageIndex, m_iResolution) . This will help us to further investigate issue.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan

The issues you have found earlier (filed as CADNET-617) have been fixed in this update.