Xuất mỗi Bố cục vào tệp PNG riêng biệt
Contents
[
Hide
]Cách xuất mỗi Bố cục vào tệp PNG riêng biệt
Vấn đề: Cách xuất mỗi Bố cục vào tệp PNG riêng biệt.
Mẹo: Để làm điều này, bạn chỉ cần đi qua tất cả các lớp và thực hiện phương thức Lưu trên mỗi lớp.
Ví dụ:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |