Filigran ile Çalışma
Bir DWG Dosyasına Filigran Ekle
Bazen çizimlere, çizimlerin amacını veya kim tarafından oluşturulduğunu belirtmek için bazı filigranlar eklemek istersiniz. Aspose.CAD for .NET, bir DWG dosyasına filigran eklemenizi sağlar. Bu, belirli bir metin yüksekliği, döndürme, stil, ayarlamalar gibi özelliklerle bir Text veya MText varlığı oluşturarak yapılabilir ve böylece iyi bir görünüm elde edilebilir. Bunun için API, CadMText ve CadText sınıflarını sağlar.
Örnek Kod
Aşağıdaki kod, Aspose.CAD for .NET kullanarak aynı hedefe nasıl ulaşabileceğinizi göstermektedir.
// The path to the documents directory. | |
string MyDir = RunExamples.GetDataDir_DWGDrawings(); | |
using(CadImage cadImage = (CadImage)Image.Load(MyDir + "Drawing11.dwg")) { | |
//add new MTEXT | |
CadMText watermark = new CadMText(); | |
watermark.Text = "Watermark message"; | |
watermark.InitialTextHeight = 40; | |
watermark.InsertionPoint = new Cad3DPoint(300, 40); | |
watermark.LayerName = "0"; | |
cadImage.BlockEntities["*Model_Space"].AddEntity(watermark); | |
// or add more simple entity like Text | |
CadText text = new CadText(); | |
text.DefaultValue = "Watermark text"; | |
text.TextHeight = 40; | |
text.FirstAlignment = new Cad3DPoint(300, 40); | |
text.LayerName = "0"; | |
cadImage.BlockEntities["*Model_Space"].AddEntity(text); | |
// export to pdf | |
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions(); | |
rasterizationOptions.PageWidth = 1600; | |
rasterizationOptions.PageHeight = 1600; | |
rasterizationOptions.Layouts = new[] { "Model" }; | |
PdfOptions pdfOptions = new PdfOptions(); | |
pdfOptions.VectorRasterizationOptions = rasterizationOptions; | |
cadImage.Save(MyDir + "AddWatermark_out.pdf", pdfOptions); | |
} | |