Free Support Forum - aspose.com

Loading DWG file no longer works in 20.1

Hi there!

We upgraded Aspose.CAD from 19.9 to 20.1 and conversion to PDF of an DWG that used to work is failing in 20.1.

The input file is input.zip (43.3 KB).

The exception we get is:

Aspose.CAD.CadExceptions.ImageLoadException: Image loading failed: Cannot process loading further due to incorrect file format structure.
—> System.Exception: Cannot process loading further due to incorrect file format structure.
at .ReadDwg(Stream , , )
at .(Stream , LoadOptions )
at .Load(StreamContainer , LoadOptions )
at Aspose.CAD.Image.LoadImage(StreamContainer streamContainer, LoadOptions loadOptions)
— End of inner exception stack trace —
at Aspose.CAD.Image.LoadImage(StreamContainer streamContainer, LoadOptions loadOptions)
at Aspose.CAD.Image.Load(Stream stream, LoadOptions loadOptions)
at Aspose.CAD.Image.Load(Stream stream)

The conversion code is as follows:

        using (var cadImage = (CadImage) Image.Load(input))
        {
            var cadPageSizes = CadPageSizesForA4(cadImage.UnitType);

            var rasterizationOptions = new CadRasterizationOptions
            {
                PageWidth = cadPageSizes.PageWidth,
                PageHeight = cadPageSizes.PageHeight,
                UnitType = cadPageSizes.UnitType,
                DrawType = CadDrawTypeMode.UseObjectColor
            };

            cadImage.Save(output, new PdfOptions
            {
                VectorRasterizationOptions = rasterizationOptions
            });
        }

This piece of code used works with version 19.9 of this component and the input file.

Thank you!

@gwert,

I have worked with the sample file shared and have created an issue with ID CADNET-1032 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.