---
Product: Aspose.PDF
Platform: go
Page Type: kb
Canonical URL: https://kb.aspose.org/pdf/go/faq
Last Updated: 2026-05-23
---

# Frequently Asked Questions

FAQ about Aspose.PDF FOSS for Go — licensing, installation, API usage, format support, encryption, AcroForms, rendering to image, text search, and known limitations.

## Licensing and Open Source

### What is the license for Aspose.PDF FOSS for Go?

Aspose.PDF FOSS for Go is released under the **MIT License**. The full license text is
included in the repository at
[github.com/aspose-pdf-foss/aspose-pdf-foss-for-go](https://github.com/aspose-pdf-foss/aspose-pdf-foss-for-go).
No registration, activation file, or runtime key is required.

### Can I use Aspose.PDF FOSS for Go in a commercial product?

Yes. The MIT license permits unrestricted commercial use, modification, distribution,
and private use. You must include the copyright notice and MIT license text in all
copies or substantial portions of the software.

### Is there an enterprise version?

Aspose.PDF FOSS is the open-source, MIT-licensed edition. A separate commercial
Aspose.PDF product is available as the [Aspose.PDF — Enterprise Product Family](https://products.aspose.com/pdf/)
with enterprise support, extended format coverage, and cloud integration.

---

## Installation and Requirements

### How do I install Aspose.PDF FOSS for Go?

Add the module to your Go project:

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

Import it with an alias in your source files:

```go
import pdf "github.com/aspose-pdf-foss/aspose-pdf-foss-for-go"
```

### What Go version is required?

Go 1.24 or later is required. Verify your version with `go version`.

### Are there native or system library dependencies?

No. Aspose.PDF FOSS for Go is a pure-Go implementation with no C, C++, or CGo
dependencies. It does not require any system libraries, PDF viewers, or external tools.

---

## API Usage

### How do I open an existing PDF?

Use `pdf.Open` for standard PDFs and `pdf.OpenWithPassword` for password-protected files:

```go
doc, err := pdf.Open("document.pdf")
if err != nil {
    panic(err)
}
fmt.Println(doc.PageCount())
```

### How do I split a PDF into individual pages?

`Document.Split` returns a `[]*Document`, one per page:

```go
doc, _ := pdf.Open("report.pdf")
pages, _ := doc.Split()
for i, p := range pages {
    p.Save(fmt.Sprintf("page_%03d.pdf", i+1))
}
```

### How do I merge multiple PDFs?

`Document.Append` merges a source document in-place:

```go
base, _ := pdf.Open("part1.pdf")
part2, _ := pdf.Open("part2.pdf")
base.Append(part2)
base.Save("combined.pdf")
```

### How do I fill an AcroForm field?

Use `Document.Form().Field(name)` and assert the concrete type:

```go
doc, _ := pdf.Open("form.pdf")
text := doc.Form().Field("customer_name").(*pdf.TextBoxField)
text.SetValue("Jane Doe")

check := doc.Form().Field("agree").(*pdf.CheckboxField)
check.SetChecked(true)

doc.Save("form_filled.pdf")
```

Supported field types: `TextBoxField`, `CheckboxField`, `RadioButtonField`,
`ComboBoxField`, `ListBoxField`, `ButtonField`.

### How do I add bookmarks?

Create an `OutlineItemCollection` and set a `Destination`:

```go
doc, _ := pdf.Open("manual.pdf")
page, _ := doc.Page(1)

bm := pdf.NewOutlineItemCollection(doc)
bm.SetTitle("Chapter 1")
bm.SetDestination(pdf.NewDestinationXYZ(page, 0, 800, 1.0))
doc.Outlines().Add(bm)
doc.Save("manual_with_bookmarks.pdf")
```

---

## Security and Encryption

### How do I password-protect a PDF?

Use `Document.SetEncryption` with an `EncryptionOptions` struct to apply password protection and permission flags. Provide a user password for opening the file and an owner password for modification rights:

```go
doc, _ := pdf.Open("doc.pdf")
doc.SetEncryption(pdf.EncryptionOptions{
    UserPassword:  "userpass",
    OwnerPassword: "ownerpass",
    Permissions:   &pdf.Permissions{AllowPrint: true, AllowCopy: false},
})
doc.Save("doc_protected.pdf")
```

### Which encryption algorithms are supported?

Three algorithms are available via `EncryptionOptions.Algorithm`:

| Algorithm | Constant | Standard |
|---|---|---|
| AES-128 | `EncryptionAlgAES128` (default) | ISO 32000-1 |
| AES-256 | `EncryptionAlgAES256` | ISO 32000-2 (PDF 2.0 output) |
| RC4-128 | `EncryptionAlgRC4_128` | Legacy |

### How do I open a password-protected file?

Use `pdf.OpenWithPassword` when the file requires authentication. Pass the user password as the second argument; it returns a normal `*Document` once decryption succeeds:

```go
doc, err := pdf.OpenWithPassword("protected.pdf", "userpass")
if err != nil {
    panic(err)
}
fmt.Println(doc.PageCount())
```

### How do I remove encryption from a PDF?

Call `Document.RemoveEncryption` after opening the file with the correct password. Save the result to write an unencrypted copy:

```go
doc, _ := pdf.OpenWithPassword("protected.pdf", "userpass")
doc.RemoveEncryption()
doc.Save("decrypted.pdf")
```

---

## Rendering and Text

### How do I render a PDF page to an image?

Use one of the device types: `BmpDevice`, `PngDevice`, `JpegDevice`, `TiffDevice`, or
`GifDevice`. Construct the device with a `Resolution` value and call the corresponding
`Render*` method with an `io.Writer` and `RenderOptions`:

```go
doc, _ := pdf.Open("report.pdf")
page, _ := doc.Page(1)
f, _ := os.Create("page1.png")
defer f.Close()
page.RenderPNG(f, pdf.RenderOptions{DPI: 150})
```

### How do I search for text in a PDF?

Call `Document.SearchText` with a query string and `SearchOptions`. The result is a
slice of `TextMatch` values — each carries the matched text, its page index, and its
bounding box.

```go
doc, _ := pdf.Open("doc.pdf")
matches, _ := doc.SearchText("total", pdf.SearchOptions{CaseInsensitive: true})
for _, m := range matches {
    fmt.Printf("page %d: %q\n", m.PageNumber, m.Text)
}
```

### How do I flatten a form?

Call `Document.Flatten` after filling or reviewing a form. The method bakes all field
values into the page graphics and removes the interactive form fields:

```go
doc, _ := pdf.Open("filled.pdf")
doc.Flatten()
doc.Save("flat.pdf")
```

---

## Known Limitations

### Are all PDF features supported?

The library covers the most common document management operations: open, create, save,
split, merge, page extraction, encryption, AcroForms, tables, bookmarks, annotations,
rendering to image, text search, and form flattening.
Advanced features such as digital signatures, 3D content, and PDF/A conversion may not
be fully implemented in the current release. Check the repository README for the current
feature status.

### What happens if I use a field type assertion that does not match?

A type assertion on `Field` that does not match the actual field type will panic.
Use `pdf.FieldType(f)` to inspect the type before asserting, or use a type switch:

```go
doc, _ := pdf.Open("form.pdf")
for _, f := range doc.Form().Fields() {
    switch v := f.(type) {
    case *pdf.TextBoxField:
        fmt.Println("text:", v.Value())
    case *pdf.CheckboxField:
        fmt.Println("checked:", v.Checked())
    }
}
```

## See Also

- [Aspose.PDF — Enterprise Knowledge Base](https://kb.aspose.com/pdf/)