雲開發者的好消息! GroupDocs 推出了 Watermark Cloud API。這增強了 GroupDocs 水印解決方案。它已經作為 .NET 和 Java 開發人員的本地 API 以及任何類型用戶的跨平台在線應用程序 存在。 Watermark Cloud API 和 SDK 允許開發人員使用水印保護重要文檔,這些文檔很難被第三方工具自動刪除。
GroupDocs.Watermark Cloud 是 REST API,提供保護文檔和管理水印的所有主要功能。一些重要的功能包括:添加圖像或文本水印,刪除已添加的水印,替換或搜索所有支持格式的水印。
支持的文檔類型
以下是當前支持的文檔格式。您可以隨時訪問 GroupDocs.Watermark Cloud 的文檔,以全面了解適用於任何支持的文檔格式的特定功能。
SDK 和示例
除了水印REST API,GroupDocs還提供開源SDK,甚至可以根據需求進行自定義。開發人員可以使用相關的SDK來加快開發速度,而無需擔心發出請求和處理響應的底層細節。目前,我們已經推出了以下 SDK 以及示例。這些 SDK 和示例也可在 GitHub 上獲取:
以下是一些示例,可以幫助您獲得更好的想法。如需更多示例,您可以訪問[文檔][10]頁面或訪問相關的[GitHub存儲庫][11]。
Java中為Word文檔添加圖像水印
您可以在此處查看使用 [GroupDocs.Watermark Cloud SDK for Java][12] 向 Word 文檔添加水印的 Java 代碼示例。
// 如需完整示例和數據文件,請訪問 https://github.com/groupdocs-watermark-cloud/groupdocs-watermark-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
WatermarkApi apiInstance = new WatermarkApi(configuration);
WatermarkOptions options = new WatermarkOptions();
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("documents/sample.docx");
options.setFileInfo(fileInfo);
WatermarkDetails watermarkDetails = new WatermarkDetails();
ImageWatermarkOptions imageWatermarkOptions = new ImageWatermarkOptions();
FileInfo image = new FileInfo();
image.setFilePath("watermark_images/sample_watermark.png");
imageWatermarkOptions.setImage(image);
watermarkDetails.setImageWatermarkOptions(imageWatermarkOptions);
List<WatermarkDetails> watermarkDetailsList = new ArrayList<WatermarkDetails>();
watermarkDetailsList.add(watermarkDetails);
options.setWatermarkDetails(watermarkDetailsList);
AddRequest request = new AddRequest(options);
WatermarkResult response = apiInstance.add(request);
C# 中的 PDF 文檔去除水印
下面的代碼片段展示瞭如何使用 [GroupDocs.Watermark Cloud SDK for .NET][13] 在 CSharp 中快速刪除 PDF 文檔中的任何水印。
// For complete examples and data files, please go to https://github.com/groupdocs-watermark-cloud/groupdocs-watermark-cloud-dotnet-samples
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
var configuration = new Configuration(MyAppSid, MyAppKey);
var apiInstance = new InfoApi(configuration);
var fileInfo = new FileInfo
{
FilePath = "with_watermarks/sample.pdf",
};
var options = new RemoveOptions
{
FileInfo = fileInfo,
ImageSearchCriteria = new ImageSearchCriteria
{
ImageFileInfo = new FileInfo { FilePath = "watermark_images/sample_watermark.png" }
},
TextSearchCriteria = new TextSearchCriteria
{
SearchText = "Watermark text"
},
OutputFolder = "removed_watermarks"
};
var request = new RemoveRequest(options);
var response = apiInstance.Remove(request);
使用 Java 替換 PDF 文檔中的水印
以下 Java 示例展示瞭如何替換已識別的水印屬性。水印圖像、文本或文本外觀選項(如字體、大小、顏色等)可以輕鬆替換。
// 如需完整示例和數據文件,請訪問 https://github.com/groupdocs-watermark-cloud/groupdocs-watermark-cloud-java-samples
String MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
String MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configuration configuration = new Configuration(MyAppSid, MyAppKey);
WatermarkApi apiInstance = new WatermarkApi(configuration);
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("with_watermarks/sample.pdf");
ReplaceOptions options = new ReplaceOptions();
options.setFileInfo(fileInfo);
ImageSearchCriteria imageSearchCriteria = new ImageSearchCriteria();
FileInfo imageFileInfo = new FileInfo();
imageFileInfo.setFilePath("watermark_images/sample_watermark.png");
imageSearchCriteria.setImageFileInfo(imageFileInfo);
options.setImageSearchCriteria(imageSearchCriteria);
TextSearchCriteria textSearchCriteria = new TextSearchCriteria();
textSearchCriteria.setSearchText("Watermark text");
options.setTextSearchCriteria(textSearchCriteria);
ReplaceTextOptions replaceTextOptions = new ReplaceTextOptions();
replaceTextOptions.setText("New watermark text");
options.setReplaceTextOptions(replaceTextOptions);
ReplaceImageOptions replaceImageOptions = new ReplaceImageOptions();
FileInfo replaceImageFileInfo = new FileInfo();
replaceImageFileInfo.setFilePath("images/sample.jpg");
replaceImageOptions.setImage(replaceImageFileInfo);
options.setReplaceImageOptions(replaceImageOptions);
options.setOutputFolder("found_image_watermarks");
ReplaceRequest request = new ReplaceRequest(options);
ReplaceResult response = apiInstance.replace(request);
使用 C# 在文檔中搜索水印
REST API 提供了一組豐富的搜索條件來查找目標文檔中可能的圖像和文本水印。
// For complete examples and data files, please go to https://github.com/groupdocs-parser-cloud/groupdocs-parser-cloud-dotnet-samples
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
var configuration = new Configuration(MyAppSid, MyAppKey);
var apiInstance = new InfoApi(configuration);
var fileInfo = new FileInfo
{
FilePath = "with_watermarks/sample.pdf"
};
var options = new SearchOptions
{
FileInfo = fileInfo,
ImageSearchCriteria = new ImageSearchCriteria
{
ImageFileInfo = new FileInfo { FilePath = "watermark_images/sample_watermark.png" }
},
TextSearchCriteria = new TextSearchCriteria
{
SearchText = "Watermark text"
},
SaveFoundImages = true,
OutputFolder = "found_image_watermarks"
};
var request = new SearchRequest(options);
var response = apiInstance.Search(request);
資源
以下是相關資源的一些重要鏈接。即使這樣,如果您感到任何困難或困惑,您也可以在[論壇][14]上自由聯繫我們。
很高興在這裡見到你[水印][15]。
[5]: https://wiki.fileformat.com/image/jpeg/" target="_blank" rel=“noreferrer noopener” aria-label=" (opens in a new tab [6]: https://wiki.fileformat.com/view/pdf/" target="_blank" rel=“noreferrer noopener” aria-label=“PDF (opens in a new tab [7]: https://github.com/groupdocs-watermark-cloud/groupdocs-watermark-cloud-dotnet-samples" target="_blank” rel=“noreferrer noopener” aria-label=".NET Examples (opens in a new tab [8]: https://github.com/groupdocs-watermark-cloud/groupdocs-watermark-cloud-java" target="_blank" rel=“noreferrer noopener” aria-label=“Java SDK (opens in a new tab [9]: https://github.com/groupdocs-watermark-cloud/groupdocs-watermark-cloud-java-samples" target="_blank” rel=“noreferrer noopener” aria-label=“Java Examples (opens in a new tab [10]: https://docs.groupdocs.cloud/watermark [11]: https://github.com/groupdocs-watermark-cloud [12]: https://products.groupdocs.cloud/watermark/java [13]: https://products.groupdocs.cloud/watermark/net [14]: https://forum.groupdocs.cloud/c/watermark [15]: https://en.wikipedia.org/wiki/Watermark