If so you can download any of the below versions for testing. The product will function as normal except for an evaluation limitation. At the time of purchase we provide a license file via email that will allow the product to work in its full capacity. If you would also like an evaluation license to test without any restrictions for 30 days, please follow the directions provided here.
If you experience errors, when you try to download a file, make sure your network policies (enforced by your company or ISP) allow downloading ZIP and/or MSI files.

安装
此包在 nuget.org 上提供,可通过包管理器控制台执行以下命令安装:
NuGet\Install-Package GroupDocs.Watermark-Cloud

要求
快速入门
获取 API 凭据
要使用 GroupDocs.Watermark Cloud,请在 GroupDocs.Cloud 仪表板 注册并获取 Client ID 和 Client Secret。
初始化 API
使用以下代码开始使用 GroupDocs.Watermark Cloud SDK for .NET。
using GroupDocs.Watermark.Cloud.Sdk.Api;
using GroupDocs.Watermark.Cloud.Sdk.Client;
var configuration = new Configuration("YourClientId", "YourClientSecret");
var apiInstance = new WatermarkApi(configuration);
完整示例见 Common.cs。
添加文本水印
此示例向 Word 文档添加 Arial 文本水印。
using System.Collections.Generic;
using GroupDocs.Watermark.Cloud.Sdk.Api;
using GroupDocs.Watermark.Cloud.Sdk.Client;
using GroupDocs.Watermark.Cloud.Sdk.Model;
using GroupDocs.Watermark.Cloud.Sdk.Model.Requests;
var configuration = new Configuration("YourClientId", "YourClientSecret");
var apiInstance = new WatermarkApi(configuration);
var options = new WatermarkOptions
{
FileInfo = new FileInfo { FilePath = "documents/sample.docx" },
WatermarkDetails = new List<WatermarkDetails>
{
new WatermarkDetails
{
TextWatermarkOptions = new TextWatermarkOptions
{
Text = "New watermark text",
FontFamilyName = "Arial",
FontSize = 12d
}
}
}
};
var response = apiInstance.Add(new AddRequest(options));
Console.WriteLine("Resultant file path: " + response.Path);
完整示例见 AddTextWatermarks.cs。
添加图像水印
此示例向 Word 文档添加图像水印。
using System.Collections.Generic;
using GroupDocs.Watermark.Cloud.Sdk.Api;
using GroupDocs.Watermark.Cloud.Sdk.Client;
using GroupDocs.Watermark.Cloud.Sdk.Model;
using GroupDocs.Watermark.Cloud.Sdk.Model.Requests;
var configuration = new Configuration("YourClientId", "YourClientSecret");
var apiInstance = new WatermarkApi(configuration);
var options = new WatermarkOptions
{
FileInfo = new FileInfo { FilePath = "documents/sample.docx" },
WatermarkDetails = new List<WatermarkDetails>
{
new WatermarkDetails
{
ImageWatermarkOptions = new ImageWatermarkOptions
{
Image = new FileInfo { FilePath = "watermark_images/sample_watermark.png" }
}
}
}
};
var response = apiInstance.Add(new AddRequest(options));
Console.WriteLine("Resultant file path: " + response.Path);
完整示例见 AddImageWatermarks.cs。
搜索水印
此示例在 PDF 中搜索文本水印和图像水印。
using GroupDocs.Watermark.Cloud.Sdk.Api;
using GroupDocs.Watermark.Cloud.Sdk.Client;
using GroupDocs.Watermark.Cloud.Sdk.Model;
using GroupDocs.Watermark.Cloud.Sdk.Model.Requests;
var configuration = new Configuration("YourClientId", "YourClientSecret");
var apiInstance = new WatermarkApi(configuration);
var options = new SearchOptions
{
FileInfo = new FileInfo { FilePath = "with_watermarks/sample.pdf" },
TextSearchCriteria = new TextSearchCriteria { SearchText = "Watermark text" },
ImageSearchCriteria = new ImageSearchCriteria
{
ImageFileInfo = new FileInfo { FilePath = "watermark_images/sample_watermark.png" }
}
};
var response = apiInstance.Search(new SearchRequest(options));
foreach (var watermark in response.Watermarks)
{
Console.WriteLine($"Id: {watermark.Id}, Type: {watermark.PossibleWatermarkType}");
}
完整示例见 SearchWatermarks.cs。
删除水印
此示例从 PDF 中删除匹配的文本水印和图像水印。
using GroupDocs.Watermark.Cloud.Sdk.Api;
using GroupDocs.Watermark.Cloud.Sdk.Client;
using GroupDocs.Watermark.Cloud.Sdk.Model;
using GroupDocs.Watermark.Cloud.Sdk.Model.Requests;
var configuration = new Configuration("YourClientId", "YourClientSecret");
var apiInstance = new WatermarkApi(configuration);
var options = new RemoveOptions
{
FileInfo = new FileInfo { FilePath = "with_watermarks/sample.pdf" },
TextSearchCriteria = new TextSearchCriteria { SearchText = "Watermark text" },
ImageSearchCriteria = new ImageSearchCriteria
{
ImageFileInfo = new FileInfo { FilePath = "watermark_images/sample_watermark.png" }
},
OutputFolder = "removed_watermarks"
};
var response = apiInstance.Remove(new RemoveRequest(options));
Console.WriteLine("Resultant file path: " + response.Path);
完整示例见 RemoveWatermarks.cs。
GitHub 上的示例
GroupDocs.Watermark Cloud .NET Examples 仓库包含可直接运行的示例,涵盖:
| Category | Examples |
|---|
| 水印 | 添加文本、添加图像、搜索、替换、删除 |
| Info | 文档信息、支持的文件类型 |
如何运行示例
- 克隆或下载 示例仓库
- 在 Visual Studio 2017 或更高版本中打开
Examples/GroupDocs.Watermark.Cloud.Examples.sln - 右键单击解决方案并选择 Enable NuGet Package Restore
- 编辑
Examples/GroupDocs.Watermark.Cloud.Examples.CSharp/RunExamples.cs,设置 Common.MyAppSid 和 Common.MyAppKey - 生成并运行
更多细节请参阅 Getting Started。
