Installation

Installation

This page explains how to add Aspose.PDF FOSS for Go to an existing Go module project.


Prerequisites

RequirementDetail
Go version1.24 or later (go version must print go1.24 or higher)
Module modeProject must be a Go module (go.mod present)
Network accessgo get fetches from GitHub; proxy or GONOSUMCHECK may be needed in air-gapped envs

Step 1 — Initialise a Go module (if needed)

If your project does not yet have a go.mod, initialise one first:

go mod init your-module-name

Step 2 — Add the dependency

Run go get to fetch and record the module:

go get github.com/aspose-pdf-foss/aspose-pdf-foss-for-go

This updates go.mod and go.sum. The module path is github.com/aspose-pdf-foss/aspose-pdf-foss-for-go.


Step 3 — Import and verify

Create a minimal main.go to confirm the import resolves:

package main

import (
    "fmt"
    pdf "github.com/aspose-pdf-foss/aspose-pdf-foss-for-go"
)

func main() {
    doc := pdf.NewDocument()
    doc.AddBlankPageFromFormat(pdf.PageFormatA4)
    if err := doc.Save("verify.pdf"); err != nil {
        panic(err)
    }
    fmt.Println("verify.pdf written — installation OK")
}

Run it:

go run main.go

A verify.pdf file in the current directory confirms the installation is working.


Step 4 — Tidy the module graph

After confirming the import, run go mod tidy to remove any unused dependencies that may have been introduced:

go mod tidy

Next Steps

  • Quick Start — open an existing PDF and perform a first operation
  • License — MIT license terms and attribution requirements
  • Developer Guide — feature-level documentation

See Also