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

# FileSpecification

## Overview

`FileSpecification` is a class in Aspose.PDF FOSS for .NET.
Inherits from: `IDisposable`.

Represents an embedded file specification (PDF §7.11.3).

This class provides 10 methods for working with FileSpecification objects in .NET programs.
Available methods include: `Dispose`, `FileSpecification`, `GetData`, `GetValue`, `SetValue`.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: `AFRelationship`, `CollectionItem`, `Contents`, `Description`, `Encoding`, `EncryptedPayload`, and 9 more.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `Name` | `string` | Read/Write | The file name. |
| `Description` | `string?` | Read/Write | The file description. |
| `Contents` | `Stream?` | Read/Write | Stream for reading or setting the embedded file data. |
| `StreamContents` | `Stream?` | Read | Alias for Contents. |
| `MimeType` | `string?` | Read/Write | The MIME type (from /Subtype of the embedded file stream). |
| `MIMEType` | `string?` | Read/Write | Alias for MimeType naming. |
| `Params` | `FileParams` | Read/Write | The /Params dict on the embedded-file stream, wrapped as a FileParams. |
| `UnicodeName` | `string?` | Read/Write | UTF-16 file name (/UF entry, PDF 2.0 preferred over /F). |
| `FileSystem` | `string?` | Read/Write | File-system identifier carried in /FS. |
| `IncludeContents` | `bool` | Read/Write | When true, the file spec carries an embedded-file stream (/EF entry). |
| `AFRelationship` | `AFRelationship` | Read/Write | Relationship between the embedded file and the document content that references it (/AFRelationship, PDF 2.0 §7.11.3). |
| `Encoding` | `FileEncoding` | Read/Write | Compression applied to the embedded stream's data when the spec is added to a document: Zip stores it FlateDecode-compressed, None stores it raw. |
| `EncryptedPayload` | `EncryptedPayload` | Read | Encrypted-payload metadata (PDF 2.0 unencrypted-wrapper support). |
| `CollectionItem` | `CollectionItem` | Read | Schema-driven collection metadata (portfolio /Collection items). |
| `Size` | `long?` | Read | The uncompressed size of the embedded file (legacy alias — see FileParams for the proper accessor). |

## Methods

| Signature | Description |
|-----------|-------------|
| `FileSpecification()` | Empty file specification with no backing file or stream. |
| `FileSpecification(file: string)` | Create a new file specification for embedding a file (no description). |
| `FileSpecification(file: string, description: string)` | Create a new file specification for embedding a file. |
| `FileSpecification(fileName: string, annot: Aspose.Pdf.Annotations.Annotation)` | Create a file specification linked to a file-attachment annot. |
| `FileSpecification(stream: Stream, name: string)` | Create a new file specification for embedding a stream (no description). |
| `FileSpecification(stream: Stream, name: string, description: string)` | Create a new file specification for embedding a stream. |
| `GetData()` | Get the embedded file data as a byte array. |
| `GetValue(key: string)` | Read a custom name/value pair previously set via SetValue(string, string). |
| `SetValue(key: string, value: string)` | Store a custom name/value pair on the spec. |
| `Dispose()` | Releases resources held by the file spec. |

## See Also

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