隐水印
Contents
[
Hide
]隐水印
您可以使用文本或图像作为隐水印,Apose.CAD库提供了添加和检查隐水印所需的所有工具
使用文本作为隐水印
示例代码:
This file contains 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
// Text embedding and validation | |
string inputFileName = "Tyrannosaurus.dxf"; | |
string embeddedFileName = "Tyrannosaurus_embedded.dxf"; | |
// Watermark data | |
string watermarkText = "The grass grows and the orioles fly"; | |
// Embed | |
var inputImage = Image.Load(inputFileName); | |
bool embedSuccess = inputImage.WatermarkGuardService.EmbedText(watermarkText); | |
inputImage.Save(embeddedFileName, new DxfOptions()); | |
// Validate | |
var embeddedImage = Image.Load(embeddedFileName); | |
bool validateSuccess = embeddedImage.WatermarkGuardService.ValidateText(watermarkText); |
带有文本隐水印的文件
使用文本作为隐水印的文件外观示例。
- 添加文本隐水印之前的文件
- 添加文本隐水印后的结果
使用另一幅图像作为隐水印
示例代码:
This file contains 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
string inputFileName = "robot_handling_cell.dxf"; | |
string watermarkFileName = "Clock-Icon.png"; | |
string embeddedFileName = "robot_handling_cell_embedded.dxf"; | |
// Watermark data | |
var watermarkStream = new MemoryStream(File.ReadAllBytes(watermarkFileName)); | |
// Embed | |
var inputImage = Image.Load(inputFileName); | |
bool embedSuccess = inputImage.WatermarkGuardService.EmbedImage(watermarkStream); | |
inputImage.Save(embeddedFileName, new DxfOptions()); | |
// Validate | |
var embeddedImage = Image.Load(embeddedFileName); | |
bool validateSuccess = embeddedImage.WatermarkGuardService.ValidateImage(watermarkStream); |
将另一幅图像添加为隐水印
使用另一幅图像添加隐水印的文件视图示例。
- 添加图像作为隐水印之前的文件
- 添加图像作为隐水印后的结果