Thêm hình mờ vào PDF tệp hoặc Word hoặc xóa hình mờ đã thêm trước đó bằng cách sử dụng Java

Với thư viện Java này, các nhà phát triển có thể thêm hình mờ hình ảnh hoặc văn bản trên PDF tài liệu hoặc Word, cũng như xóa hình mờ đã thêm trong vài giây

Bảo vệ tài liệu của bạn khỏi phân phối trái phép và thêm hình mờ trực tuyến. Để thực hiện việc này, chỉ cần tải PDF định dạng, Word hoặc tài liệu khác và thêm hình mờ văn bản hoặc hình ảnh bằng cách sử dụng Java. Sau đó, lưu PDF tài liệu hoặc Word đã được đánh dấu chìm ở định dạng thuận tiện như DOC, DOCX, PDF, HTML, RTF, XPS và các định dạng khác. Bạn cũng có thể xóa hình mờ khỏi tài liệu để xử lý chúng dễ dàng hơn trừ khi nó vi phạm quyền của bất kỳ ai.

Xem đoạn mã

Thêm hình mờ trong Java

Với API Java này, các nhà phát triển có thể thêm hình mờ vào PDF, Word hoặc các tài liệu khác trực tuyến. Bạn có thể tạo hình mờ bằng văn bản hoặc hình ảnh, sau đó chèn hình mờ đó vào PDF tài liệu hoặc Word của mình bằng cách đặt góc lớp phủ trong Java.

Lưu ý: không cần cài đặt bất kỳ ứng dụng hoặc thư viện nào của bên thứ ba. Do đó, giải pháp phần mềm Java của chúng tôi rất dễ sử dụng.

Xóa hình mờ trong Java

SDK Java đã cung cấp cũng rất hữu ích để loại bỏ các hình mờ. Ví dụ: xóa hình mờ trong Word có nghĩa là bạn có thể tải Word tài liệu mong muốn được đóng dấu bằng hình mờ văn bản hoặc hình ảnh, xóa hình mờ này khỏi tài liệu bằng Java, sau đó lưu tệp đầu ra ở định dạng thuận tiện.

Hình mờ trong Word hoặc PDF

Để đánh giá API Java của chúng tôi, hãy tải tài liệu mà bạn muốn thêm hình mờ và hình mờ dưới dạng hình ảnh hoặc văn bản. Sau đó chọn định dạng tệp xuất thuận tiện - DOCX, PDF, MD, HTML, TXT, DOC, RTF, EPUB, XPS và các định dạng khác.

Sử dụng ví dụ sau để xem nó hoạt động như thế nào:

Tệp cần thêm hình mờ
Mã vận hành
Tải lên hình ảnh bạn muốn chèn
Chọn định dạng mục tiêu từ danh sách
import com.aspose.words.cloud.*;

ApiClient apiClient = new ApiClient("####-####-####-####-####", "##################", null);
WordsApi wordsApi = new WordsApi(apiClient);

byte[] requestDocument = Files.readAllBytes(Paths.get("Input1.docx").toAbsolutePath());
byte[] requestImageFile = Files.readAllBytes(Paths.get("Input2.docx").toAbsolutePath());
InsertWatermarkImageOnlineRequest insertWatermarkImageOnline = 
   new InsertWatermarkImageOnlineRequest(requestDocument, requestImageFile, 
      null, null, null, null, null, null, null, null);
InsertWatermarkImageOnline insertedWatermarkImage = 
   wordsApi.insertWatermarkImageOnline(insertWatermarkImageOnline);

ConvertDocumentRequest convertDocument = new ConvertDocumentRequest(
   insertedWatermarkImage.getDocument().iterator().next(), "docx", 
      null, null, null, null, null, null, null);
wordsApi.convertDocument(convertDocument);
import com.aspose.words.cloud.*;

ApiClient apiClient = new ApiClient("####-####-####-####-####", "##################", null);
WordsApi wordsApi = new WordsApi(apiClient);

byte[] requestDocument = Files.readAllBytes(Paths.get("Input.docx").toAbsolutePath());
WatermarkText requestWatermarkText = new WatermarkText();
requestWatermarkText.setText("This is the watermark text.");
requestWatermarkText.setRotationAngle((double)90);

InsertWatermarkTextOnlineRequest insertWatermarkTextOnline = 
   new InsertWatermarkTextOnlineRequest(requestDocument, requestWatermarkText, 
      null, null, null, null, null, null);
InsertWatermarkTextOnline insertedWatermarkText = 
   wordsApi.insertWatermarkTextOnline(insertWatermarkTextOnline);

ConvertDocumentRequest convertDocument = new ConvertDocumentRequest(
   insertedWatermarkText.getDocument().iterator().next(), "docx", 
      null, null, null, null, null, null, null);
wordsApi.convertDocument(convertDocument);
import com.aspose.words.cloud.*;

ApiClient apiClient = new ApiClient("####-####-####-####-####", "##################", null);
WordsApi wordsApi = new WordsApi(apiClient);

byte[] requestDocument = Files.readAllBytes(Paths.get("Input.docx").toAbsolutePath());
DeleteWatermarkOnlineRequest deleteWatermarkOnline = 
   new DeleteWatermarkOnlineRequest(requestDocument, null, null, null, null, null, null);
DeleteWatermarkOnline deletedWatermark = wordsApi.deleteWatermarkOnline(deleteWatermarkOnline);

ConvertDocumentRequest convertDocument = new ConvertDocumentRequest(
   deletedWatermark.getDocument().iterator().next(), "docx", 
      null, null, null, null, null, null, null);
wordsApi.convertDocument(convertDocument);
Mã vận hành
  
Sao chép mã Java vào khay nhớ tạm

Cách xóa hình mờ trong Java

  1. Cài đặt Aspose.Words Cloud for Java
  2. Thêm tham chiếu thư viện (nhập thư viện) vào dự án Java của bạn
  3. Định cấu hình API bằng các khóa ứng dụng của bạn
  4. Tải tài liệu bạn muốn xóa hình mờ
  5. Tạo yêu cầu xóa hình mờ
  6. Lưu kết quả thành một định dạng tệp thuận tiện

Java thư viện để sử dụng hình mờ

Cài đặt 'Aspose.Words Cloud SDK for Java' bằng cách sử dụng công cụ tự động hóa bản dựng Maven.

Thêm phần phụ thuộc này vào POM của dự án của bạn: aspose-cloud artifact.aspose-cloud-releases http://artifact.aspose.cloud/repo com.aspose aspose-words-cloud 22.4.0

Thay vào đó, bạn có thể sao chép Aspose.Words Cloud SDK for Java từ GitHub và sử dụng nó trong dự án của mình. Vui lòng làm theo các Instructions này để nhanh chóng nhận được thông tin xác thực bảo mật cần thiết và truy cập REST API của chúng tôi.

yêu cầu hệ thống

Tham khảo Repository Documentation để xem chi tiết.

Các định dạng tài liệu phổ biến nhất để thêm hình mờ

5%

Đăng ký cập nhật sản phẩm của Aspose

Nhận bản tin hàng tháng và ưu đãi gửi trực tiếp đến hộp thư của bạn.

© Aspose Pty Ltd 2001-2024. Đã đăng ký Bản quyền.