---
Product: Aspose.PDF
Platform: go
Page Type: reference
Canonical URL: https://reference.aspose.org/pdf/go/javascriptcollection
---

# JavaScriptCollection

## Overview

`JavaScriptCollection` is a type in Aspose.PDF FOSS for Go.

JavaScriptCollection is the document-level JavaScript store, backed by the /Catalog/Names/JavaScript name tree (ISO 32000-1 §7.7.4 / §8.5.1).

This type declares 7 methods for JavaScriptCollection objects in Go programs.
Available methods include: `Add`, `Clear`, `Count`, `Get`, `Has`, `Names`, `Remove`.
Public members are accessible to any Go application after installing the Aspose.PDF FOSS for Go package.

## Methods

| Signature | Description |
|-----------|-------------|
| `Count()` → `int` | Count reports how many named scripts are in the collection. |
| `Has(name: string)` → `bool` | Has reports whether a script with the given name exists. |
| `Get(name: string)` → `string` | Get returns the script registered under name, or "" if absent. |
| `Names()` → `[]string` | Names returns the script names in lexical order (the order they are written to the name tree). |
| `Add(name: string, script: string)` → `error` | Add registers (or replaces) a named script and writes it through to the /Catalog/Names/JavaScript name tree. |
| `Remove(name: string)` → `bool` | Remove deletes the named script. |
| `Clear()` | Clear removes every named script. |

## See Also

- [Aspose.PDF — Enterprise API Reference](https://reference.aspose.com/pdf/)