Thêm, chỉnh sửa, tìm kiếm và xóa hình mờ khỏi mọi định dạng tệp tài liệu và hình ảnh phổ biến bằng cách sử dụng Cloud SDK cho Java và REST API.
Bắt đầu dùng thử miễn phíAPI linh hoạt, giàu tính năng và cung cấp các phương pháp đơn giản để quản lý và thao tác hình mờ trên một số loại tài liệu. REST API hỗ trợ mọi loại tính năng hình mờ như thêm, tìm kiếm, cập nhật và xóa mà không cần sử dụng bất kỳ phần mềm bên ngoài nào. Java SDK cho REST API Watermark giúp có thể tìm kiếm hình mờ trong tài liệu và chỉnh sửa hoặc xóa hình mờ đã được bất kỳ công cụ của bên thứ ba nào thêm vào. Nó cũng cho phép tùy chỉnh hình mờ bằng cách chỉ định kiểu văn bản, phông chữ, kích thước, màu sắc hoặc vị trí theo yêu cầu của dự án.
GroupDocs.Watermark Cloud là một REST API khiến nó trở thành lựa chọn hoàn hảo cho các lập trình viên sử dụng với bất kỳ ngôn ngữ hoặc nền tảng nào có khả năng thực hiện lệnh gọi REST API. Nó dễ dàng tích hợp với các dịch vụ đám mây khác để cung cấp trải nghiệm quản lý hình mờ tối ưu trên các nền tảng web, máy tính để bàn di động hoặc đám mây.
//Get your App SID, App Key and Storage Name at https://dashboard.groupdocs.cloud (free registration is required).
public class RemoveWatermarks {
public static void main(String[] args) {
WatermarkApi apiInstance = new WatermarkApi(Common.GetConfiguration());
try {
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("with_watermarks/sample.pdf");
fileInfo.setStorageName(Common.MyStorage);
RemoveOptions options = new RemoveOptions();
options.setFileInfo(fileInfo);
ImageSearchCriteria imageSearchCriteria = new ImageSearchCriteria();
FileInfo imageFileInfo = new FileInfo();
imageFileInfo.setFilePath("watermark_images/sample_watermark.webp");
imageFileInfo.setStorageName(Common.MyStorage);
imageSearchCriteria.setImageFileInfo(imageFileInfo);
options.setImageSearchCriteria(imageSearchCriteria);
TextSearchCriteria textSearchCriteria = new TextSearchCriteria();
textSearchCriteria.setSearchText("Watermark text");
options.setTextSearchCriteria(textSearchCriteria);
options.setOutputFolder("removed_watermarks");
RemoveRequest request = new RemoveRequest(options);
RemoveResult response = apiInstance.remove(request);
System.out.println("Resultant file path: " + response.getPath());
} catch (ApiException e) {
System.err.println("Exception while calling WatermarkApi:");
e.printStackTrace();
}
}
}