Error converting a DWG


#1

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

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)


#2

@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.


#3

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


#4

@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.


#5

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


#6

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 )


#7

@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.


#8

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


#9

@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.


#10

We tried in debug and on server but we thrown the outofmemory exeption with that file
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);
        }

#11

@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.


#12

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…


#13

@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.


#14

hello, any news?


#15

@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.