HTML JPG PDF XML DOCX
  Product Family
PDF

Compare PDF files in Go SDK

API for comparing PDF documents using Aspose.PDF Cloud Go SDK

Get Started

How to compare PDFs via Cloud Go SDK

To compare PDF documents, we’ll use Aspose.PDF Cloud Go SDK This Cloud SDK 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 compare PDF files via Go

Aspose.PDF Cloud developers can easily load & compare PDF files in just a few lines of code.

  1. Initialize the Aspose.PDF API Client.
  2. Upload both PDF documents to the remote folder.
  3. Set optional parameters for the API call.
  4. Perform PDF comparison using Aspose Cloud API.
  5. Handle the response.
  6. Download the resulting comparison PDF file.
 

Compare PDF files using Cloud Go SDK


    package main

    import (
        "fmt"
        "path"

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

    const (
        REMOTE_FOLDER  = "Your_Temp_Pdf_Cloud"
        LOCAL_FOLDER   = "c:\\Samples"
        PDF_DOCUMENT_1 = "sample_compare_1.pdf"
        PDF_DOCUMENT_2 = "sample_compare_2.pdf"
        PDF_OUTPUT     = "output_compare.pdf"

        PDF_API_SID = "******"
        PDF_API_KEY = "******"
    )

    func СomparePdf(pdf_api *asposepdfcloud.PdfApiService, document1 string, document2 string, output_document string, remote_folder string) {
        uploadFile(pdf_api, document1)
        uploadFile(pdf_api, document2)

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

        result, httpResponse, err := pdf_api.PostComparePdf(path.Join(REMOTE_FOLDER, document1), path.Join(REMOTE_FOLDER, document2), path.Join(REMOTE_FOLDER, output_document), args)
        if err != nil {
            fmt.Println(err.Error())
        } else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
            fmt.Println("Unexpected error!")
        } else {
            fmt.Println(result)
            downloadFile(pdf_api, PDF_OUTPUT, PDF_OUTPUT)
        }
    }
 

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 test the functionality.

  •