ส่งออกแต่ละเลย์เอาต์ในไฟล์ PNG แยก

วิธีการส่งออกแต่ละเลย์เอาต์ในไฟล์ PNG แยก

ปัญหา: วิธีการส่งออกแต่ละเลย์เอาต์ในไฟล์ PNG แยก

เคล็ดลับ: เพื่อทำเช่นนี้ คุณเพียงแค่ต้องไปผ่านทุกชั้นและดำเนินการเมธอด Save บนแต่ละชั้น

ตัวอย่าง:

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