HTML JPG PDF XML DOCX
  Product Family
PDF

Get link from PDF via PDf.Cloud Go SDK

API for getting link from PDF documents using server-side Go API.

Get Started

How to extract link annotation from PDF documents using Cloud Go SDK

For getting Links from 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 get link by Id using Go SDK

Aspose.PDF Cloud developers can easily extract link annotation by Id from PDF documents. Developers need just a few lines of code.

  1. Create a new Configuration object with your Application Secret and Key
  2. Create an object to connect to the Cloud API
  3. Upload your document file
  4. Extract link annotation by Id from PDF documents using GetLinkAnnotation function
  5. Checks the response and logs the result
  6. If the operation is successful, you can print the link annotation or use the link annotation in another way
 

This sample code shows getting link annotation by Id from PDF document

    package main

    import (
	"fmt"

	asposepdfcloud "github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v25"
    )

    func getLink(pdf_api *asposepdfcloud.PdfApiService, document string, link_id string, remote_folder string) {
	uploadFile(pdf_api, document)

	args := map[string]interface{}{
		"folder": remote_folder,
	}

	result, httpResponse, err := pdf_api.GetLinkAnnotation(document, link_id, args)
	if err != nil {
		fmt.Println(err.Error())
	} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
		fmt.Println("Unexpected error!")
	} else {
		links := []asposepdfcloud.LinkAnnotation{*result.Link}
		showLinks(&links)
	}
    }