HTML
JPG
PDF
XML
DOCX
PDF
Thay thế Chú thích Văn bản trong PDF qua Go SDK
API cho việc thay thế chú thích trong tài liệu PDF với Aspose.PDF Cloud Go SDK
Get StartedCách thay thế chú thích văn bản trong tài liệu PDF bằng Cloud Go SDK
Để thay thế chú thích trong tài liệu PDF, chúng tôi sẽ sử dụng Aspose.PDF Cloud Go SDK SDK này hỗ trợ các lập trình viên Go phát triển các ứng dụng tạo, chú thích, chỉnh sửa và chuyển đổi PDF trên nền tảng đám mây bằng ngôn ngữ lập trình Go thông qua Aspose.PDF REST API. Sử dụng lệnh sau từ Package Manager Console.
Lệnh Console của Package Manager
go get -u github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v25
Các bước thay thế chú thích bằng Go
Các nhà phát triển Aspose.PDF Cloud Go có thể dễ dàng thay thế chú thích trong tài liệu PDF. Các nhà phát triển chỉ cần vài dòng mã.
- Tải tệp lên lưu trữ đám mây.
- getAnnotation lấy một chú thích văn bản theo ID từ một PDF được lưu trữ trên đám mây.
- ModifyAnnotation cập nhật nội dung và biểu tượng của chú thích đó.
- Sau khi sửa đổi, PDF đã cập nhật được tải xuống cục bộ.
Mẫu mã này cho thấy việc thay thế Chú thích Văn bản trong tài liệu PDF bằng PDF Cloud Go SDK
package main
import (
"fmt"
asposepdfcloud "github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v25"
)
func getAnnotation(pdf_api *asposepdfcloud.PdfApiService, document_name string, annotation_id string, remote_folder string) *asposepdfcloud.TextAnnotation {
// Get annotation by Id in the PDF document.
args := map[string]interface{}{
"folder": remote_folder,
}
result, httpResponse, err := pdf_api.GetTextAnnotation(document_name, annotation_id, args)
if err != nil {
fmt.Println(err.Error())
return nil
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
fmt.Println("getAnnotation(): Failed to get annotation in the document.")
return nil
} else {
fmt.Println("getAnnotation(): nnotation '" + annotation_id + "' successfully found '" + result.Annotation.Contents + "' in the document '" + document_name + "'.")
return result.Annotation
}
}
func ModifyAnnotation(pdf_api *asposepdfcloud.PdfApiService, document_name string, output_document string, annotation_id string, remote_folder string) {
// Change annotation by Id in the PDF document.
UploadFile(pdf_api, document_name)
args := map[string]interface{}{
"folder": remote_folder,
}
annotation := getAnnotation(pdf_api, document_name, annotation_id, remote_folder)
annotation.Contents = REPLACED_CONTENT
annotation.Icon = asposepdfcloud.TextIconStar
_, httpResponse, err := pdf_api.PutTextAnnotation(document_name, annotation_id, *annotation, args)
if err != nil {
fmt.Println(err.Error())
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
fmt.Println("ModifyAnnotation(): Failed to modify annotation in the document.")
} else {
fmt.Println("ModifyAnnotation(): annotation '" + annotation.Id + "' successfully modified in the document '" + document_name + "'.")
DownloadFile(pdf_api, document_name, output_document, "replaced_annotatiom_")
}
}
Với Go SDK của chúng tôi, bạn có thể
- Thêm tiêu đề & chân trang của tài liệu PDF dưới dạng văn bản hoặc hình ảnh.
- Thêm bảng & tem văn bản hoặc hình ảnh vào tài liệu PDF.
- Nối nhiều tài liệu PDF vào một tệp hiện có.
- Làm việc với tệp đính kèm, chú thích và trường biểu mẫu trong PDF.
- Áp dụng mã hóa hoặc giải mã cho tài liệu PDF & đặt mật khẩu.
- Xóa tất cả tem & bảng từ một trang hoặc toàn bộ tài liệu PDF.
- Xóa một tem hoặc bảng cụ thể từ tài liệu PDF theo ID của nó.
- Thay thế một hoặc nhiều lần xuất hiện của văn bản trên một trang PDF hoặc từ toàn bộ tài liệu.
- Hỗ trợ rộng rãi cho việc chuyển đổi tài liệu PDF sang nhiều định dạng tệp khác.
- Trích xuất các yếu tố khác nhau của tệp PDF & tối ưu hóa tài liệu PDF.
- Bạn có thể thử ứng dụng miễn phí của chúng tôi để thay thế chú thích trong tệp PDF trực tuyến và kiểm tra chức năng.
- Tài nguyên Học tập
- Tài liệu
- Mã nguồn
- Tham khảo API
- Hỗ Trợ Sản Phẩm
- Hỗ Trợ Miễn Phí
- Hỗ Trợ Trả Phí
- Blog
- Tại Sao Chọn Aspose.PDF Cloud cho Go?
- Danh Sách Khách Hàng
- Bảo Mật