Free Support Forum - aspose.com

Image loading failed: Arithmetic operation resulted in an overflow

Trying to convert dwf to PDF using c# (Aspose.CAD v20.7.0):

           using (DwfImage cadImage = (Aspose.CAD.FileFormats.Dwf.DwfImage)Image.Load(cadFile))
            {
                CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions
                {
                    PageWidth = isA3 ? 420 : 297,
                    PageHeight = isA3 ? 297 : 210,
                    UnitType = UnitType.Millimeter,
                    AutomaticLayoutsScaling = false,
                    Zoom = 0.9F
                };

                PdfOptions pdfOptions = new PdfOptions
                {
                    VectorRasterizationOptions = rasterizationOptions
                };

                cadImage.Save(pdfFile, pdfOptions);

            }

however it is failing with some files with the following error at the Image.Load stage:

  Image loading failed: Arithmetic operation resulted in an overflow.

The file is a (DWF V06.00) and opens in dwf viewer just fine.

Can you suggest any reason for this error? Anything I can try as it seems to be common.

Happy to share the dwf file so you can try it yourself.

Stack:

at . ​ (Int32 , Int32 )
at Aspose.CAD.FileFormats.Dwf.Whip.Objects.Drawable.DwfWhipPointSet.Materialize16Bit( parser)
at Aspose.CAD.FileFormats.Dwf.Whip.Objects.Drawable.DwfWhipPolymarker.Materialize( operationCode, parser)
at .()
at .()
at .()
at .LoadDrawableResources(List`1 )
at Aspose.CAD.FileFormats.Dwf.DwfImage.CreateEplotImage()
at Aspose.CAD.FileFormats.Dwf.DwfImage…ctor( dwfPackageManager)
at .Parse(Stream , LoadOptions )
at Aspose.CAD.FileFormats.Dwf.DwfLoader.Load(StreamContainer streamContainer, LoadOptions loadOptions)
at Aspose.CAD.Image.LoadImage(StreamContainer streamContainer, LoadOptions loadOptions)

@robparmenter

Can you please share the source CAD file reproducing the issue on your end so that we may investigate the issue further on our end to help you out.