Free Support Forum -

Unable to convert dwf files

We have been using Aspose.CAD for a while with great success however recently we have been getting a few files that it seems unable to open - Null Exception. They are mostly coming from one customer and we can open them in DWF viewer fine. Other CAD files open well.

We are trying to extract the pages as JPEGs.

Could you let me know if this is a newer version file that the product is unable to open or anything I can look into as to why it will not open?


Can you please try using latest Aspose.CAD version on your end and share the used sample code along with stack trace with us.

That was the latest version of Aspose.CAD:

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);



Error Message: Arithmetic operation resulted in an overflow.
Error Source: Aspose.CAD
Error HResult: -2146233066
Machine Name: TRUSSCORPWKS53
Employee: Rob Parmenter

Frame 1 - Error Line: 28, 28
Frame 1 - Error Method: Void ConvertDwfToPdf(System.String, System.String, Boolean)
Stack Trace: Aspose.CAD
Image loading failed: Arithmetic operation resulted in an overflow.
at Aspose.CAD.Image.LoadImage(StreamContainer streamContainer, LoadOptions loadOptions)
at Aspose.CAD.Image.Load(String filePath)
at TrussCorp.Web.CadFileFunctions.ConvertDwfToPdf(String cadFile, String pdfFile, Boolean isA3) in C:\Users\robparmenter\repos\TrussCorp.Web\CadFileFunctions.cs:line 28

Arithmetic operation resulted in an overflow.
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.CreateInnerImage()
at Aspose.CAD.FileFormats.Dwf.DwfImage…ctor( dwfPackageManager)
at . (Stream , LoadOptions )
at . (StreamContainer , LoadOptions )
at Aspose.CAD.Image.LoadImage(StreamContainer streamContainer, LoadOptions loadOptions)


I have created an issue with ID CADNET-1261 in our issue tracking system after reproducing the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.