We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Wrong unit type and Image export failed when convert dwf to png

Hi guys,
I’m using Aspose CAD for .NET v19.9 and run this snippet to convert dwf to png.
using (DwfImage image = (DwfImage)GetImage(inFile))
ImageOptionsBase imgOption = new PngOptions();
string outFileDir = @“D:”;
foreach (var page in image.Pages)
string outfile = Path.Combine(outFileDir, page.Name + “.png”);
using (FileStream fs = new FileStream(outfile, FileMode.Create))
CadRasterizationOptions options = new CadRasterizationOptions
Layouts = new string[] { page.Name }
if (page.UnitType == UnitType.Inch)
Console.WriteLine(“Unit is Inch”);
Console.WriteLine(“Unit is something else.”);
options.PageHeight = image.Height * 300;
options.PageWidth = image.Width * 300;
imgOption.VectorRasterizationOptions = options;
image.Save(fs, imgOption);
catch(Exception e)

With file exception.dwf, there is “Image export failed” when calling image.Save.
With file wrong_unit.dwf, I expect the unit is Inch but it’s milimeter when I debug the sample file.
I run this code on Windows 10 64bit, Aspose Cad v19.9 for .Net 4.0.

Please investigate this problem. Thanks.sample_files.zip (144.0 KB)


I have worked with the sample file shared and have been able to observe the issue. An issue with ID CADNET-969 has been created on 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.

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