Thêm hình mờ vào DOC hoặc xóa các hình mờ đã thêm trước đó bằng cách sử dụng Go

Sử dụng thư viện Go này, đóng dấu DOC tài liệu bằng hình mờ hình ảnh hoặc văn bản hoặc xóa hình mờ đã thêm trong một vài bước

Thêm hình mờ văn bản hoặc hình ảnh vào DOC tài liệu bằng Go. Tải DOC tài liệu và chèn hình mờ cần thiết vào đó. Sau đó, lưu kết quả ở định dạng thuận tiện như DOCX, PDF, MD, HTML, TXT, DOC, RTF, EPUB, XPS, v.v. và chia sẻ tài liệu đã được đánh dấu mờ với người khác. Đồng thời xóa hình mờ khỏi DOC tài liệu nếu hình mờ trước đó đã được thêm vào tài liệu và lý do thêm không còn phù hợp nữa.

Xem đoạn mã

DOC - thêm hình mờ trong Go

Với API Go này, các nhà phát triển có thể thêm hình mờ vào DOC trực tuyến. Chỉ cần tạo hình mờ bằng văn bản hoặc hình ảnh và sau đó chèn hình mờ đó vào DOC tài liệu của bạn bằng Go.

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 Go của chúng tôi rất dễ sử dụng.

Xóa hình mờ khỏi DOC - Go

SDK Go đã cho cũng rất hữu ích để xóa hình mờ khỏi DOC. Xóa hình mờ trong DOC có nghĩa là bạn có thể tải DOC 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 DOC bằng Go, sau đó lưu tệp đầu ra ở định dạng thuận tiện - DOC, DOCX, PDF, JPEG, PNG, TIFF và những thứ khác.

Làm việc với hình mờ trong DOC

Để đánh giá cách thêm hoặc xóa hình mờ trong DOC bằng API Go của chúng tôi, hãy tải DOC 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 - DOC, DOCX, PDF, HTML, RTF, 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 (
    "os"
    "github.com/aspose-words-cloud/aspose-words-cloud-go/dev/api/models"
)

config, _ := models.NewConfiguration("config.json")
wordsApi, ctx, _ := api.CreateWordsApi(config)

requestDocument, _ := os.Open("Input1.doc")
requestImageFile, _ := os.Open("Input2.doc")
insertWatermarkImageOnlineOptions := map[string]interface{}{}
insertWatermarkImageOnline := &models.InsertWatermarkImageOnlineRequest{
    Document: requestDocument,
    ImageFile: requestImageFile,
    Optionals: insertWatermarkImageOnlineOptions,
}
insertedWatermarkImage = wordsApi.InsertWatermarkImageOnline(ctx, insertWatermarkImageOnline)

convertDocumentOptions := map[string]interface{}{}
convertDocument := &models.ConvertDocumentRequest{
    Document: insertedWatermarkImage.Document.Values[0],
    Format: ToStringPointer("doc"),
    Optionals: convertDocumentOptions,
}
_, _ = wordsApi.ConvertDocument(ctx, convertDocument)
import (
    "os"
    "github.com/aspose-words-cloud/aspose-words-cloud-go/dev/api/models"
)

config, _ := models.NewConfiguration("config.json")
wordsApi, ctx, _ := api.CreateWordsApi(config)

requestDocument, _ := os.Open("Input.doc")
requestWatermarkText := models.WatermarkText{
    Text: ToStringPointer("This is the watermark text."),
    RotationAngle: ToFloat64Pointer(90),
}
insertWatermarkTextOnlineOptions := map[string]interface{}{}
insertWatermarkTextOnline := &models.InsertWatermarkTextOnlineRequest{
    Document: requestDocument,
    WatermarkText: &requestWatermarkText,
    Optionals: insertWatermarkTextOnlineOptions,
}
insertedWatermarkText = wordsApi.InsertWatermarkTextOnline(ctx, insertWatermarkTextOnline)

convertDocumentOptions := map[string]interface{}{}
convertDocument := &models.ConvertDocumentRequest{
    Document: insertedWatermarkText.Document.Values[0],
    Format: ToStringPointer("doc"),
    Optionals: convertDocumentOptions,
}
_, _ = wordsApi.ConvertDocument(ctx, convertDocument)
import (
    "os"
    "github.com/aspose-words-cloud/aspose-words-cloud-go/dev/api/models"
)

config, _ := models.NewConfiguration("config.json")
wordsApi, ctx, _ := api.CreateWordsApi(config)

requestDocument, _ := os.Open("Input.doc")
deleteWatermarkOnlineOptions := map[string]interface{}{}
deleteWatermarkOnline := &models.DeleteWatermarkOnlineRequest{
    Document: requestDocument,
    Optionals: deleteWatermarkOnlineOptions,
}
deletedWatermark = wordsApi.DeleteWatermarkOnline(ctx, deleteWatermarkOnline)

convertDocumentOptions := map[string]interface{}{}
convertDocument := &models.ConvertDocumentRequest{
    Document: deletedWatermark.Document.Values[0],
    Format: ToStringPointer("doc"),
    Optionals: convertDocumentOptions,
}
_, _ = wordsApi.ConvertDocument(ctx, convertDocument)
Mã vận hành
  
Sao chép mã Go vào khay nhớ tạm

Cách xóa hình mờ trong DOC bằng cách sử dụng Go

  1. Cài đặt Aspose.Words Cloud for Go
  2. Thêm tham chiếu thư viện (nhập thư viện) vào dự án Go 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 DOC 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

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

Chạy go get -v github.com/aspose-words-cloud/aspose-words-cloud-go/2007/api để cài đặt Aspose.Words Cloud SDK for Go. Bạn có thể nhận được nhiều thông tin hữu ích về các phương pháp cài đặt khác từ phần "How to use SDK".

Sao chép mã nguồn Aspose.Words Cloud SDK for Go từ GitHub và sử dụng nó trong dự án của bạn. 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ệp được hỗ trợ khác

Bạn có thể thêm hình mờ vào tài liệu ở các định dạng khác:

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.