Add Underline Text Annotations to PDF via Go SDK
API for adding annotations to PDF documents with Aspose.PDF Cloud Go SDK
Get StartedHow to append annotations to PDF documents using Cloud Go SDK
For adding underline text annotations to PDF documents, we’ll use Aspose.PDF Cloud Go SDK This Cloud Go SDK assists Go programmers in developing cloud-based PDF creator, annotator, editor, and converter apps using Go programming language via Aspose.PDF REST API. Use the following command from the Package Manager Console.
Package Manager Console Command
go get -u github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v25
Steps to add annotations using Go
Aspose.PDF Cloud Go developers can easily append annotations to PDF documents. Developers need just a few lines of code.
- Uploading the file to cloud storage.
- Define the Underline Annotation (Color, Positioning, etc).
- Compose the Annotation Object with UnderlineAnnotation.
- Post the Annotation to the PDF Page.
- Downloading the modified document if successful.
This sample code shows adding Underline Text annotations to PDF document using PDF Cloud Go SDK
package main
import (
"fmt"
asposepdfcloud "github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v25"
)
func AppendUnderlineAnnotation(pdf_api *asposepdfcloud.PdfApiService, document_name string, page_num int32, output_document string, prefix string, remote_folder string) {
// Append a new underline text annotation to the PDF document.
UploadFile(pdf_api, document_name)
args := map[string]interface{}{
"folder": remote_folder,
}
new_annotation := asposepdfcloud.UnderlineAnnotation{
Rect: &asposepdfcloud.Rectangle{LLX: 100, LLY: 350, URX: 450, URY: 400},
Name: "Underline Text Annotation",
Flags: []asposepdfcloud.AnnotationFlags{asposepdfcloud.AnnotationFlagsDefault},
HorizontalAlignment: asposepdfcloud.HorizontalAlignmentLeft,
VerticalAlignment: asposepdfcloud.VerticalAlignmentTop,
RichText: NEW_UL_ANNOTATION_TEXT,
Subject: NEW_UL_ANNOTATION_SUBJECT,
Title: NEW_UL_ANNOTATION_DESCRIPTION,
Contents: NEW_UL_ANNOTATION_CONTENTS,
ZIndex: 1,
Color: &asposepdfcloud.Color{A: 0xFF, R: 0x00, G: 0xFF, B: 0x00},
QuadPoints: []asposepdfcloud.Point{
{X: 10, Y: 10},
{X: 20, Y: 10},
{X: 10, Y: 20},
{X: 10, Y: 10},
},
Modified: "03/27/2025 00:00:00.000 AM",
}
_, httpResponse, err := pdf_api.PostPageUnderlineAnnotations(document_name, page_num, []asposepdfcloud.UnderlineAnnotation{new_annotation}, args)
if err != nil {
fmt.Println(err.Error())
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
fmt.Println("AppendUnderlineAnnotation(): Failed to append annotation to the document page.")
} else {
fmt.Println("AppendUnderlineAnnotation(): annotation '" + NEW_UL_ANNOTATION_TEXT + "' added to the document '" + document_name + "'.")
DownloadFile(pdf_api, document_name, output_document, prefix)
}
}
Work with the annotations in PDF via Go SDK
Adding annotations to a PDF serves many important purposes across different use cases. One of the most common reasons is for review and feedback. Annotations let users highlight specific parts of a document, leave comments, ask questions, or suggest changes. This makes the review process more efficient and organized, especially when multiple collaborators are involved. Add the Annotations into PDF documents with Aspose.PDF Cloud Go SDK.
With our Go SDK you can
- Add PDF document’s header & footer in text or image format.
- Add tables & text or image stamps to PDF documents.
- Append multiple PDF documents to an existing file.
- Work with PDF attachments, annotations, & form fields.
- Apply encryption or decryption to PDF documents & set a password.
- Delete all stamps & tables from a page or entire PDF document.
- Delete a specific stamp or table from the PDF document by its ID.
- Replace single or multiple instances of text on a PDF page or from the entire document.
- Extensive support for converting PDF documents to various other file formats.
- Extract various elements of PDF files & make PDF documents optimized.
- You can try out our free App to add the annotations into PDF files online and test the functionality.
- Learning Resources
- Documentation
- Source Code
- API References
- Product Support
- Free Support
- Paid Support
- Blog
- Why Aspose.PDF Cloud for Go?
- Customers List
- Security