تصدير كل تخطيط في ملف PNG منفصل

كيفية تصدير كل تخطيط في ملف PNG منفصل

المشكلة: كيفية تصدير كل تخطيط في ملف PNG منفصل.

نصائح: للقيام بذلك، تحتاج فقط إلى المرور عبر جميع الطبقات وتنفيذ طريقة الحفظ على كل واحدة.

مثال:

using CadImage cadImage = (CadImage)Image.Load(fileName);
var rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.PageSize = new SizeF(cadImage.Width, cadImage.Height);
CadLayoutDictionary layouts = cadImage.Layouts;
foreach (CadLayout layout in layouts.Values)
{
rasterizationOptions.Layouts = new string[] { layout.LayoutName };
ImageOptionsBase option = new PngOptions();
option.VectorRasterizationOptions = rasterizationOptions;
cadImage.Save(layout.LayoutName + ".png", option);
}