Hi guys,
I’m using Aspose CAD for .NET v19.9 and run this snippet to convert dwf to png.
try
{
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”);
else
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)
{
Console.WriteLine(e.Message);
}
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)