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

# FileAttachmentAnnotation

## Overview

`FileAttachmentAnnotation` is a type in Aspose.PDF FOSS for Go.
Inherits from: `annotationBase`.

FileAttachmentAnnotation embeds a file in the document and shows an icon at the annotation's /Rect.

This type declares 13 methods for FileAttachmentAnnotation objects in Go programs.
Available methods include: `AnnotationType`, `FileBytes`, `FileDescription`, `FileMIMEType`, `FileName`, `FileSize`, `HasFile`, `Icon`, `RegenerateAppearance`, `SetFile`, `SetFileDescription`, `SetFileFromStream`, and 1 additional methods.
Public members are accessible to any Go application after installing the Aspose.PDF FOSS for Go package.

## Methods

| Signature | Description |
|-----------|-------------|
| `AnnotationType()` → `AnnotationType` | Returns the annotation type. |
| `Icon()` → `FileAttachmentIcon` | Icon returns the /Name entry mapped to a FileAttachmentIcon. |
| `SetIcon(i: FileAttachmentIcon)` | SetIcon writes the /Name entry. |
| `HasFile()` → `bool` | HasFile returns true if SetFile or SetFileFromStream has been called successfully and not subsequently cleared. |
| `RegenerateAppearance()` | RegenerateAppearance is a no-op for FileAttachmentAnnotation (no /AP — viewers render the icon themselves). |
| `SetFile(path: string)` → `error` | SetFile embeds the file at path as the annotation's attachment. |
| `SetFileFromStream(r: io.Reader, name: string)` → `error` | SetFileFromStream is the io.Reader variant of SetFile. |
| `FileName()` → `string` | FileName returns the displayed filename from /Filespec/F. |
| `FileMIMEType()` → `string` | FileMIMEType returns the /Subtype on /EmbeddedFile (e.g. |
| `FileSize()` → `int` | FileSize returns the size of the embedded file in bytes. |
| `FileBytes()` → `[]byte` | FileBytes returns a defensive copy of the embedded file's raw bytes. |
| `FileDescription()` → `string` | FileDescription returns /Filespec/Desc. |
| `SetFileDescription(s: string)` | SetFileDescription writes /Filespec/Desc. |

## See Also

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