HTML JPG PDF XML DOCX
  Product Family
PDF

Merge PDF documents via Aspose.PDF Cloud Go SDK

API for merging multiple PDF documents into one using Aspose.PDF Cloud Go SDK

Get Started

How to Merge several PDF Files Using Aspose.PDF Cloud Go SDK

Now, managing and organizing documents is essential for businesses and individuals. Merging multiple PDF files into one document simplifies sharing, archiving, and printing. Whether you need to combine multiple reports, invoices, or contracts, merging PDFs offers a clean, organized solution. With Aspose Cloud Go Library, you can easily merge multiple PDF documents programmatically using the power of cloud computing. This guide will walk you through merging PDF files using Aspose’s Cloud API in Go.

Why do I need to merge multiple PDF documents?

Combine multiple related documents into a single file for easy management. Merge invoices, receipts, or reports for a client into a single file for streamlined sharing. Reduce the number of files in storage by consolidating them into one compact document. Save time by automating the process of merging multiple files.

Merge PDFs with Go

The PDF Cloud Go SDK offers an easy-to-use and secure API for merging PDF files quickly and accurately, even when dealing with complex formatting. Instead of manually combining files, you can merge them in seconds with just a single method call from the Go SDK. There’s no need to install additional software—document merging happens in the cloud, offloading the process from your local system and saving resources.

Package Manager Console Command


     
    go get -u github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v25
     
     

Steps for Merging PDF via Cloud Go

A basic merging pdfs programmatically with Aspose.PDF Cloud Go SDK APIs can be done with just few lines of code.

  1. Create a new MergeDocuments instance to hold the list of input document paths.
  2. Upload each input PDF document to the remote folder and append its path to the mergeDocuments.List.
  3. Prepare the arguments for the PutMergeDocuments API call.
 

Merge several PDF Files using Go


package main

import (
  "fmt"
  "path"

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

func mergeDocuments(pdfAPI *asposepdfcloud.PdfApiService, outputName, remoteFolder string) {
  // Define document names to merge
  names := []string{PDF_DOCUMENT, PDF_DOCUMENT_2, PDF_DOCUMENT_3}
  
  // Initialize merge request with empty list
  mergeRequest := asposepdfcloud.MergeDocuments{List: []string{}}
  
  // Upload files and add their paths to the merge list
  for _, name := range names {
    uploadFile(pdfAPI, name)
    mergeRequest.List = append(mergeRequest.List, path.Join(remoteFolder, name))
  }
  
  // Execute merge operation
  result, httpResponse, err := pdfAPI.PutMergeDocuments(outputName, mergeRequest, map[string]interface{}{
    "folder": remoteFolder,
  })
  
  // Handle response
  if err != nil {
    fmt.Println(err.Error())
    return
  }
  
  if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
    fmt.Printf("HTTP error: %d\n", httpResponse.StatusCode)
    return
  }
  
  fmt.Println(result)
}
  
 

Combine Features and Capabilities

We offer top-tier document processing capabilities through our continually advancing Cloud SDKs, which support a variety of programming languages and major platforms. These tools empower developers to fully control and tailor document merging options to meet their unique requirements.

With our Go tool 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 merge PDF files online and test the functionality.

  •